HHH-18948 rename EventManager -> EventMonitor
This commit is contained in:
parent
eedcab3c17
commit
a3c8fa7a25
|
@ -7,9 +7,9 @@ package org.hibernate.action.internal;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.collection.spi.PersistentCollection;
|
import org.hibernate.collection.spi.PersistentCollection;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
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.EventSource;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.PostCollectionRecreateEvent;
|
import org.hibernate.event.spi.PostCollectionRecreateEvent;
|
||||||
import org.hibernate.event.spi.PostCollectionRecreateEventListener;
|
import org.hibernate.event.spi.PostCollectionRecreateEventListener;
|
||||||
import org.hibernate.event.spi.PreCollectionRecreateEvent;
|
import org.hibernate.event.spi.PreCollectionRecreateEvent;
|
||||||
|
@ -46,15 +46,15 @@ public final class CollectionRecreateAction extends CollectionAction {
|
||||||
final SharedSessionContractImplementor session = getSession();
|
final SharedSessionContractImplementor session = getSession();
|
||||||
final CollectionPersister persister = getPersister();
|
final CollectionPersister persister = getPersister();
|
||||||
final Object key = getKey();
|
final Object key = getKey();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginCollectionRecreateEvent();
|
final DiagnosticEvent event = eventMonitor.beginCollectionRecreateEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.recreate( collection, key, session );
|
persister.recreate( collection, key, session );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCollectionRecreateEvent( event, key, persister.getRole(), success, session );
|
eventMonitor.completeCollectionRecreateEvent( event, key, persister.getRole(), success, session );
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getPersistenceContextInternal().getCollectionEntry( collection ).afterAction( collection );
|
session.getPersistenceContextInternal().getCollectionEntry( collection ).afterAction( collection );
|
||||||
|
|
|
@ -8,9 +8,9 @@ import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.collection.spi.PersistentCollection;
|
import org.hibernate.collection.spi.PersistentCollection;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
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.EventSource;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.PostCollectionRemoveEvent;
|
import org.hibernate.event.spi.PostCollectionRemoveEvent;
|
||||||
import org.hibernate.event.spi.PostCollectionRemoveEventListener;
|
import org.hibernate.event.spi.PostCollectionRemoveEventListener;
|
||||||
import org.hibernate.event.spi.PreCollectionRemoveEvent;
|
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)
|
// knowing if the collection is actually empty without querying the db)
|
||||||
final CollectionPersister persister = getPersister();
|
final CollectionPersister persister = getPersister();
|
||||||
final Object key = getKey();
|
final Object key = getKey();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent();
|
final DiagnosticEvent event = eventMonitor.beginCollectionRemoveEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.remove( key, session );
|
persister.remove( key, session );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCollectionRemoveEvent( event, key, persister.getRole(), success, session );
|
eventMonitor.completeCollectionRemoveEvent( event, key, persister.getRole(), success, session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.collection.spi.PersistentCollection;
|
import org.hibernate.collection.spi.PersistentCollection;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
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.EventSource;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.PostCollectionUpdateEvent;
|
import org.hibernate.event.spi.PostCollectionUpdateEvent;
|
||||||
import org.hibernate.event.spi.PostCollectionUpdateEventListener;
|
import org.hibernate.event.spi.PostCollectionUpdateEventListener;
|
||||||
import org.hibernate.event.spi.PreCollectionUpdateEvent;
|
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
|
// Do nothing - we only need to notify the cache
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginCollectionUpdateEvent();
|
final DiagnosticEvent event = eventMonitor.beginCollectionUpdateEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
if ( !affectedByFilters && collection.empty() ) {
|
if ( !affectedByFilters && collection.empty() ) {
|
||||||
|
@ -93,7 +93,7 @@ public final class CollectionUpdateAction extends CollectionAction {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCollectionUpdateEvent( event, key, persister.getRole(), success, session );
|
eventMonitor.completeCollectionUpdateEvent( event, key, persister.getRole(), success, session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ import org.hibernate.engine.spi.EntityKey;
|
||||||
import org.hibernate.engine.spi.PersistenceContext;
|
import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.service.spi.EventListenerGroup;
|
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.EventSource;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.PostCommitDeleteEventListener;
|
import org.hibernate.event.spi.PostCommitDeleteEventListener;
|
||||||
import org.hibernate.event.spi.PostDeleteEvent;
|
import org.hibernate.event.spi.PostDeleteEvent;
|
||||||
import org.hibernate.event.spi.PostDeleteEventListener;
|
import org.hibernate.event.spi.PostDeleteEventListener;
|
||||||
|
@ -128,15 +128,15 @@ public class EntityDeleteAction extends EntityAction {
|
||||||
final Object ck = lockCacheItem();
|
final Object ck = lockCacheItem();
|
||||||
|
|
||||||
if ( !isCascadeDeleteEnabled && !veto ) {
|
if ( !isCascadeDeleteEnabled && !veto ) {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityDeleteEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityDeleteEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.getDeleteCoordinator().delete( instance, id, version, session );
|
persister.getDeleteCoordinator().delete( instance, id, version, session );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, session );
|
eventMonitor.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ import org.hibernate.engine.spi.EntityKey;
|
||||||
import org.hibernate.engine.spi.PersistenceContext;
|
import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.service.spi.EventListenerGroup;
|
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.EventSource;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.PostCommitInsertEventListener;
|
import org.hibernate.event.spi.PostCommitInsertEventListener;
|
||||||
import org.hibernate.event.spi.PostInsertEvent;
|
import org.hibernate.event.spi.PostInsertEvent;
|
||||||
import org.hibernate.event.spi.PostInsertEventListener;
|
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
|
// else inserted the same pk first, the insert would fail
|
||||||
|
|
||||||
if ( !isVeto() ) {
|
if ( !isVeto() ) {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityInsertEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityInsertEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
final GeneratedValues generatedValues;
|
final GeneratedValues generatedValues;
|
||||||
try {
|
try {
|
||||||
|
@ -92,7 +92,7 @@ public class EntityIdentityInsertAction extends AbstractEntityInsertAction {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityInsertEvent( event, generatedId, persister.getEntityName(), success, session );
|
eventMonitor.completeEntityInsertEvent( event, generatedId, persister.getEntityName(), success, session );
|
||||||
}
|
}
|
||||||
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
||||||
if ( persister.getRowIdMapping() != null ) {
|
if ( persister.getRowIdMapping() != null ) {
|
||||||
|
|
|
@ -15,8 +15,8 @@ import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.service.spi.EventListenerGroup;
|
import org.hibernate.event.service.spi.EventListenerGroup;
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
import org.hibernate.event.spi.PostCommitInsertEventListener;
|
import org.hibernate.event.spi.PostCommitInsertEventListener;
|
||||||
|
@ -105,8 +105,8 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
if ( !veto ) {
|
if ( !veto ) {
|
||||||
final EntityPersister persister = getPersister();
|
final EntityPersister persister = getPersister();
|
||||||
final Object instance = getInstance();
|
final Object instance = getInstance();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityInsertEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityInsertEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
final GeneratedValues generatedValues;
|
final GeneratedValues generatedValues;
|
||||||
try {
|
try {
|
||||||
|
@ -114,7 +114,7 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityInsertEvent( event, id, persister.getEntityName(), success, session );
|
eventMonitor.completeEntityInsertEvent( event, id, persister.getEntityName(), success, session );
|
||||||
}
|
}
|
||||||
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
||||||
final EntityEntry entry = persistenceContext.getEntry( instance );
|
final EntityEntry entry = persistenceContext.getEntry( instance );
|
||||||
|
@ -187,8 +187,8 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
|
|
||||||
protected boolean cacheInsert(EntityPersister persister, Object ck) {
|
protected boolean cacheInsert(EntityPersister persister, Object ck) {
|
||||||
final SharedSessionContractImplementor session = getSession();
|
final SharedSessionContractImplementor session = getSession();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
final EntityDataAccess cacheAccessStrategy = persister.getCacheAccessStrategy();
|
final EntityDataAccess cacheAccessStrategy = persister.getCacheAccessStrategy();
|
||||||
boolean insert = false;
|
boolean insert = false;
|
||||||
try {
|
try {
|
||||||
|
@ -197,13 +197,13 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
return insert;
|
return insert;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cacheAccessStrategy,
|
cacheAccessStrategy,
|
||||||
getPersister(),
|
getPersister(),
|
||||||
insert,
|
insert,
|
||||||
EventManager.CacheActionDescription.ENTITY_INSERT
|
EventMonitor.CacheActionDescription.ENTITY_INSERT
|
||||||
);
|
);
|
||||||
session.getEventListenerManager().cachePutEnd();
|
session.getEventListenerManager().cachePutEnd();
|
||||||
}
|
}
|
||||||
|
@ -280,8 +280,8 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
protected boolean cacheAfterInsert(EntityDataAccess cache, Object ck) {
|
protected boolean cacheAfterInsert(EntityDataAccess cache, Object ck) {
|
||||||
final SharedSessionContractImplementor session = getSession();
|
final SharedSessionContractImplementor session = getSession();
|
||||||
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
boolean afterInsert = false;
|
boolean afterInsert = false;
|
||||||
try {
|
try {
|
||||||
eventListenerManager.cachePutStart();
|
eventListenerManager.cachePutStart();
|
||||||
|
@ -289,13 +289,13 @@ public class EntityInsertAction extends AbstractEntityInsertAction {
|
||||||
return afterInsert;
|
return afterInsert;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cache,
|
cache,
|
||||||
getPersister(),
|
getPersister(),
|
||||||
afterInsert,
|
afterInsert,
|
||||||
EventManager.CacheActionDescription.ENTITY_AFTER_INSERT
|
EventMonitor.CacheActionDescription.ENTITY_AFTER_INSERT
|
||||||
);
|
);
|
||||||
eventListenerManager.cachePutEnd();
|
eventListenerManager.cachePutEnd();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.engine.spi.Status;
|
import org.hibernate.engine.spi.Status;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.service.spi.EventListenerGroup;
|
import org.hibernate.event.service.spi.EventListenerGroup;
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
import org.hibernate.event.spi.PostCommitUpdateEventListener;
|
import org.hibernate.event.spi.PostCommitUpdateEventListener;
|
||||||
|
@ -164,8 +164,8 @@ public class EntityUpdateAction extends EntityAction {
|
||||||
final Object instance = getInstance();
|
final Object instance = getInstance();
|
||||||
final Object previousVersion = getPreviousVersion();
|
final Object previousVersion = getPreviousVersion();
|
||||||
final Object ck = lockCacheItem( previousVersion );
|
final Object ck = lockCacheItem( previousVersion );
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityUpdateEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityUpdateEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
final GeneratedValues generatedValues;
|
final GeneratedValues generatedValues;
|
||||||
try {
|
try {
|
||||||
|
@ -183,7 +183,7 @@ public class EntityUpdateAction extends EntityAction {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, session );
|
eventMonitor.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, session );
|
||||||
}
|
}
|
||||||
final EntityEntry entry = session.getPersistenceContextInternal().getEntry( instance );
|
final EntityEntry entry = session.getPersistenceContextInternal().getEntry( instance );
|
||||||
if ( entry == null ) {
|
if ( entry == null ) {
|
||||||
|
@ -329,8 +329,8 @@ public class EntityUpdateAction extends EntityAction {
|
||||||
|
|
||||||
protected boolean updateCache(EntityPersister persister, Object previousVersion, Object ck) {
|
protected boolean updateCache(EntityPersister persister, Object previousVersion, Object ck) {
|
||||||
final SharedSessionContractImplementor session = getSession();
|
final SharedSessionContractImplementor session = getSession();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
final EntityDataAccess cacheAccessStrategy = persister.getCacheAccessStrategy();
|
final EntityDataAccess cacheAccessStrategy = persister.getCacheAccessStrategy();
|
||||||
boolean update = false;
|
boolean update = false;
|
||||||
try {
|
try {
|
||||||
|
@ -339,13 +339,13 @@ public class EntityUpdateAction extends EntityAction {
|
||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cacheAccessStrategy,
|
cacheAccessStrategy,
|
||||||
getPersister(),
|
getPersister(),
|
||||||
update,
|
update,
|
||||||
EventManager.CacheActionDescription.ENTITY_UPDATE
|
EventMonitor.CacheActionDescription.ENTITY_UPDATE
|
||||||
);
|
);
|
||||||
session.getEventListenerManager().cachePutEnd();
|
session.getEventListenerManager().cachePutEnd();
|
||||||
}
|
}
|
||||||
|
@ -455,21 +455,21 @@ public class EntityUpdateAction extends EntityAction {
|
||||||
|
|
||||||
protected void cacheAfterUpdate(EntityDataAccess cache, Object ck, SharedSessionContractImplementor session) {
|
protected void cacheAfterUpdate(EntityDataAccess cache, Object ck, SharedSessionContractImplementor session) {
|
||||||
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
boolean put = false;
|
boolean put = false;
|
||||||
try {
|
try {
|
||||||
eventListenerManager.cachePutStart();
|
eventListenerManager.cachePutStart();
|
||||||
put = cache.afterUpdate( session, ck, cacheEntry, nextVersion, previousVersion, lock );
|
put = cache.afterUpdate( session, ck, cacheEntry, nextVersion, previousVersion, lock );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cache,
|
cache,
|
||||||
getPersister(),
|
getPersister(),
|
||||||
put,
|
put,
|
||||||
EventManager.CacheActionDescription.ENTITY_AFTER_UPDATE
|
EventMonitor.CacheActionDescription.ENTITY_AFTER_UPDATE
|
||||||
);
|
);
|
||||||
final StatisticsImplementor statistics = session.getFactory().getStatistics();
|
final StatisticsImplementor statistics = session.getFactory().getStatistics();
|
||||||
if ( put && statistics.isStatisticsEnabled() ) {
|
if ( put && statistics.isStatisticsEnabled() ) {
|
||||||
|
|
|
@ -15,8 +15,8 @@ import org.hibernate.cache.spi.QueryResultsCache;
|
||||||
import org.hibernate.cache.spi.QueryResultsRegion;
|
import org.hibernate.cache.spi.QueryResultsRegion;
|
||||||
import org.hibernate.cache.spi.TimestampsCache;
|
import org.hibernate.cache.spi.TimestampsCache;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
|
|
||||||
import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER;
|
import static org.hibernate.cache.spi.SecondLevelCacheLogger.L2CACHE_LOGGER;
|
||||||
|
|
||||||
|
@ -61,19 +61,19 @@ public class QueryResultsCacheImpl implements QueryResultsCache {
|
||||||
deepCopy( results )
|
deepCopy( results )
|
||||||
);
|
);
|
||||||
|
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
session.getEventListenerManager().cachePutStart();
|
session.getEventListenerManager().cachePutStart();
|
||||||
cacheRegion.putIntoCache( key, cacheItem, session );
|
cacheRegion.putIntoCache( key, cacheItem, session );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cacheRegion,
|
cacheRegion,
|
||||||
true,
|
true,
|
||||||
EventManager.CacheActionDescription.QUERY_RESULT
|
EventMonitor.CacheActionDescription.QUERY_RESULT
|
||||||
);
|
);
|
||||||
session.getEventListenerManager().cachePutEnd();
|
session.getEventListenerManager().cachePutEnd();
|
||||||
}
|
}
|
||||||
|
@ -152,14 +152,14 @@ public class QueryResultsCacheImpl implements QueryResultsCache {
|
||||||
|
|
||||||
private CacheItem getCachedData(QueryKey key, SharedSessionContractImplementor session) {
|
private CacheItem getCachedData(QueryKey key, SharedSessionContractImplementor session) {
|
||||||
CacheItem cachedItem = null;
|
CacheItem cachedItem = null;
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent();
|
final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent();
|
||||||
try {
|
try {
|
||||||
session.getEventListenerManager().cacheGetStart();
|
session.getEventListenerManager().cacheGetStart();
|
||||||
cachedItem = (CacheItem) cacheRegion.getFromCache( key, session );
|
cachedItem = (CacheItem) cacheRegion.getFromCache( key, session );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCacheGetEvent(
|
eventMonitor.completeCacheGetEvent(
|
||||||
cacheGetEvent,
|
cacheGetEvent,
|
||||||
session,
|
session,
|
||||||
cacheRegion,
|
cacheRegion,
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.hibernate.cache.spi.TimestampsRegion;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
@ -58,8 +58,8 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache {
|
||||||
if ( debugEnabled ) {
|
if ( debugEnabled ) {
|
||||||
log.debugf( "Pre-invalidating space [%s], timestamp: %s", space, ts );
|
log.debugf( "Pre-invalidating space [%s], timestamp: %s", space, ts );
|
||||||
}
|
}
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
eventListenerManager.cachePutStart();
|
eventListenerManager.cachePutStart();
|
||||||
|
|
||||||
|
@ -68,12 +68,12 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache {
|
||||||
timestampsRegion.putIntoCache( space, ts, session );
|
timestampsRegion.putIntoCache( space, ts, session );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
timestampsRegion,
|
timestampsRegion,
|
||||||
true,
|
true,
|
||||||
EventManager.CacheActionDescription.TIMESTAMP_PRE_INVALIDATE
|
EventMonitor.CacheActionDescription.TIMESTAMP_PRE_INVALIDATE
|
||||||
);
|
);
|
||||||
eventListenerManager.cachePutEnd();
|
eventListenerManager.cachePutEnd();
|
||||||
}
|
}
|
||||||
|
@ -100,19 +100,19 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
eventListenerManager.cachePutStart();
|
eventListenerManager.cachePutStart();
|
||||||
timestampsRegion.putIntoCache( space, ts, session );
|
timestampsRegion.putIntoCache( space, ts, session );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
timestampsRegion,
|
timestampsRegion,
|
||||||
true,
|
true,
|
||||||
EventManager.CacheActionDescription.TIMESTAMP_INVALIDATE
|
EventMonitor.CacheActionDescription.TIMESTAMP_INVALIDATE
|
||||||
);
|
);
|
||||||
eventListenerManager.cachePutEnd();
|
eventListenerManager.cachePutEnd();
|
||||||
|
|
||||||
|
@ -192,14 +192,14 @@ public class TimestampsCacheEnabledImpl implements TimestampsCache {
|
||||||
|
|
||||||
private Long getLastUpdateTimestampForSpace(String space, SharedSessionContractImplementor session) {
|
private Long getLastUpdateTimestampForSpace(String space, SharedSessionContractImplementor session) {
|
||||||
Long ts = null;
|
Long ts = null;
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent();
|
final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent();
|
||||||
try {
|
try {
|
||||||
session.getEventListenerManager().cacheGetStart();
|
session.getEventListenerManager().cacheGetStart();
|
||||||
ts = (Long) timestampsRegion.getFromCache( space, session );
|
ts = (Long) timestampsRegion.getFromCache( space, session );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCacheGetEvent(
|
eventMonitor.completeCacheGetEvent(
|
||||||
cacheGetEvent,
|
cacheGetEvent,
|
||||||
session,
|
session,
|
||||||
timestampsRegion,
|
timestampsRegion,
|
||||||
|
|
|
@ -8,8 +8,8 @@ import org.hibernate.cache.MutableCacheKeyBuilder;
|
||||||
import org.hibernate.cache.spi.access.CachedDomainDataAccess;
|
import org.hibernate.cache.spi.access.CachedDomainDataAccess;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
@ -42,13 +42,13 @@ public final class CacheHelper {
|
||||||
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
||||||
Object cachedValue = null;
|
Object cachedValue = null;
|
||||||
eventListenerManager.cacheGetStart();
|
eventListenerManager.cacheGetStart();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent();
|
final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent();
|
||||||
try {
|
try {
|
||||||
cachedValue = cacheAccess.get( session, cacheKey );
|
cachedValue = cacheAccess.get( session, cacheKey );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCacheGetEvent(
|
eventMonitor.completeCacheGetEvent(
|
||||||
cacheGetEvent,
|
cacheGetEvent,
|
||||||
session,
|
session,
|
||||||
cacheAccess.getRegion(),
|
cacheAccess.getRegion(),
|
||||||
|
@ -69,13 +69,13 @@ public final class CacheHelper {
|
||||||
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
||||||
Object cachedValue = null;
|
Object cachedValue = null;
|
||||||
eventListenerManager.cacheGetStart();
|
eventListenerManager.cacheGetStart();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cacheGetEvent = eventManager.beginCacheGetEvent();
|
final DiagnosticEvent cacheGetEvent = eventMonitor.beginCacheGetEvent();
|
||||||
try {
|
try {
|
||||||
cachedValue = cacheAccess.get( session, cacheKey );
|
cachedValue = cacheAccess.get( session, cacheKey );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCacheGetEvent(
|
eventMonitor.completeCacheGetEvent(
|
||||||
cacheGetEvent,
|
cacheGetEvent,
|
||||||
session,
|
session,
|
||||||
cacheAccess.getRegion(),
|
cacheAccess.getRegion(),
|
||||||
|
|
|
@ -21,8 +21,8 @@ import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.engine.spi.Resolution;
|
import org.hibernate.engine.spi.Resolution;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
import org.hibernate.metamodel.mapping.NaturalIdLogging;
|
import org.hibernate.metamodel.mapping.NaturalIdLogging;
|
||||||
import org.hibernate.metamodel.mapping.NaturalIdMapping;
|
import org.hibernate.metamodel.mapping.NaturalIdMapping;
|
||||||
|
@ -265,7 +265,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
|
|
||||||
final SessionFactoryImplementor factory = s.getFactory();
|
final SessionFactoryImplementor factory = s.getFactory();
|
||||||
final StatisticsImplementor statistics = factory.getStatistics();
|
final StatisticsImplementor statistics = factory.getStatistics();
|
||||||
final EventManager eventManager = s.getEventManager();
|
final EventMonitor eventMonitor = s.getEventMonitor();
|
||||||
switch ( source ) {
|
switch ( source ) {
|
||||||
case LOAD: {
|
case LOAD: {
|
||||||
if ( CacheHelper.fromSharedCache( s, cacheKey, persister, cacheAccess ) != null ) {
|
if ( CacheHelper.fromSharedCache( s, cacheKey, persister, cacheAccess ) != null ) {
|
||||||
|
@ -273,7 +273,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean put = false;
|
boolean put = false;
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
put = cacheAccess.putFromLoad(
|
put = cacheAccess.putFromLoad(
|
||||||
s,
|
s,
|
||||||
|
@ -290,14 +290,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session(),
|
session(),
|
||||||
cacheAccess,
|
cacheAccess,
|
||||||
rootEntityPersister,
|
rootEntityPersister,
|
||||||
put,
|
put,
|
||||||
true,
|
true,
|
||||||
EventManager.CacheActionDescription.ENTITY_LOAD
|
EventMonitor.CacheActionDescription.ENTITY_LOAD
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
}
|
}
|
||||||
case INSERT: {
|
case INSERT: {
|
||||||
boolean put = false;
|
boolean put = false;
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
put = cacheAccess.insert( s, cacheKey, id );
|
put = cacheAccess.insert( s, cacheKey, id );
|
||||||
|
@ -317,14 +317,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session(),
|
session(),
|
||||||
cacheAccess,
|
cacheAccess,
|
||||||
rootEntityPersister,
|
rootEntityPersister,
|
||||||
put,
|
put,
|
||||||
true,
|
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 );
|
final SoftLock lock = cacheAccess.lockItem( s, cacheKey, null );
|
||||||
boolean put = false;
|
boolean put = false;
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
put = cacheAccess.update( s, cacheKey, id );
|
put = cacheAccess.update( s, cacheKey, id );
|
||||||
if ( put && statistics.isStatisticsEnabled() ) {
|
if ( put && statistics.isStatisticsEnabled() ) {
|
||||||
|
@ -369,14 +369,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session(),
|
session(),
|
||||||
cacheAccess,
|
cacheAccess,
|
||||||
rootEntityPersister,
|
rootEntityPersister,
|
||||||
put,
|
put,
|
||||||
true,
|
true,
|
||||||
EventManager.CacheActionDescription.ENTITY_UPDATE
|
EventMonitor.CacheActionDescription.ENTITY_UPDATE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
cacheAccess.unlockItem( s, previousCacheKey, removalLock );
|
cacheAccess.unlockItem( s, previousCacheKey, removalLock );
|
||||||
if (success) {
|
if (success) {
|
||||||
boolean putAfterUpdate = false;
|
boolean putAfterUpdate = false;
|
||||||
final HibernateMonitoringEvent cachePutEventAfterUpdate = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEventAfterUpdate = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
putAfterUpdate = cacheAccess.afterUpdate(
|
putAfterUpdate = cacheAccess.afterUpdate(
|
||||||
s,
|
s,
|
||||||
|
@ -402,14 +402,14 @@ public class NaturalIdResolutionsImpl implements NaturalIdResolutions, Serializa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEventAfterUpdate,
|
cachePutEventAfterUpdate,
|
||||||
session(),
|
session(),
|
||||||
cacheAccess,
|
cacheAccess,
|
||||||
rootEntityPersister,
|
rootEntityPersister,
|
||||||
putAfterUpdate,
|
putAfterUpdate,
|
||||||
true,
|
true,
|
||||||
EventManager.CacheActionDescription.ENTITY_AFTER_UPDATE
|
EventMonitor.CacheActionDescription.ENTITY_AFTER_UPDATE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
||||||
|
|
||||||
|
@ -258,14 +258,14 @@ public class BatchImpl implements Batch {
|
||||||
try {
|
try {
|
||||||
if ( statementDetails.getMutatingTableDetails().isIdentifierTable() ) {
|
if ( statementDetails.getMutatingTableDetails().isIdentifierTable() ) {
|
||||||
final int[] rowCounts;
|
final int[] rowCounts;
|
||||||
final EventManager eventManager = jdbcSessionOwner.getEventManager();
|
final EventMonitor eventMonitor = jdbcSessionOwner.getEventMonitor();
|
||||||
final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcBatchExecutionEvent();
|
final DiagnosticEvent executionEvent = eventMonitor.beginJdbcBatchExecutionEvent();
|
||||||
try {
|
try {
|
||||||
eventHandler.jdbcExecuteBatchStart();
|
eventHandler.jdbcExecuteBatchStart();
|
||||||
rowCounts = statement.executeBatch();
|
rowCounts = statement.executeBatch();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcBatchExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcBatchExecutionEvent( executionEvent, sql );
|
||||||
eventHandler.jdbcExecuteBatchEnd();
|
eventHandler.jdbcExecuteBatchEnd();
|
||||||
}
|
}
|
||||||
checkRowCounts( rowCounts, statementDetails );
|
checkRowCounts( rowCounts, statementDetails );
|
||||||
|
|
|
@ -30,8 +30,8 @@ import org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl;
|
||||||
import org.hibernate.engine.jdbc.internal.JdbcServicesImpl;
|
import org.hibernate.engine.jdbc.internal.JdbcServicesImpl;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||||
import org.hibernate.event.internal.EmptyEventManager;
|
import org.hibernate.event.internal.EmptyEventMonitor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.internal.log.ConnectionInfoLogger;
|
import org.hibernate.internal.log.ConnectionInfoLogger;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
@ -619,7 +619,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
private final JpaCompliance jpaCompliance;
|
private final JpaCompliance jpaCompliance;
|
||||||
private final SqlExceptionHelper sqlExceptionHelper;
|
private final SqlExceptionHelper sqlExceptionHelper;
|
||||||
TransactionCoordinator transactionCoordinator;
|
TransactionCoordinator transactionCoordinator;
|
||||||
private final EmptyEventManager eventManager;
|
private final EmptyEventMonitor eventManager;
|
||||||
|
|
||||||
public TemporaryJdbcSessionOwner(
|
public TemporaryJdbcSessionOwner(
|
||||||
JdbcConnectionAccess jdbcConnectionAccess,
|
JdbcConnectionAccess jdbcConnectionAccess,
|
||||||
|
@ -643,7 +643,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
.getDefaultConnectionHandlingMode();
|
.getDefaultConnectionHandlingMode();
|
||||||
|
|
||||||
this.jpaCompliance = new MutableJpaComplianceImpl( Collections.emptyMap(), false );
|
this.jpaCompliance = new MutableJpaComplianceImpl( Collections.emptyMap(), false );
|
||||||
this.eventManager = new EmptyEventManager();
|
this.eventManager = new EmptyEventMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -692,7 +692,7 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventManager getEventManager() {
|
public EventMonitor getEventMonitor() {
|
||||||
return eventManager;
|
return eventManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.jdbc.spi.MutationStatementPreparer;
|
import org.hibernate.engine.jdbc.spi.MutationStatementPreparer;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
||||||
|
@ -94,15 +94,15 @@ public class MutationStatementPreparerImpl implements MutationStatementPreparer
|
||||||
final PreparedStatement preparedStatement;
|
final PreparedStatement preparedStatement;
|
||||||
final JdbcSessionOwner jdbcSessionOwner = jdbcCoordinator.getJdbcSessionOwner();
|
final JdbcSessionOwner jdbcSessionOwner = jdbcCoordinator.getJdbcSessionOwner();
|
||||||
final JdbcEventHandler jdbcEventHandler = jdbcSessionOwner.getJdbcSessionContext().getEventHandler();
|
final JdbcEventHandler jdbcEventHandler = jdbcSessionOwner.getJdbcSessionContext().getEventHandler();
|
||||||
final EventManager eventManager = jdbcSessionOwner.getEventManager();
|
final EventMonitor eventMonitor = jdbcSessionOwner.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcPreparedStatementCreation = eventManager.beginJdbcPreparedStatementCreationEvent();
|
final DiagnosticEvent jdbcPreparedStatementCreation = eventMonitor.beginJdbcPreparedStatementCreationEvent();
|
||||||
try {
|
try {
|
||||||
jdbcEventHandler.jdbcPrepareStatementStart();
|
jdbcEventHandler.jdbcPrepareStatementStart();
|
||||||
preparedStatement = doPrepare();
|
preparedStatement = doPrepare();
|
||||||
setStatementTimeout( preparedStatement );
|
setStatementTimeout( preparedStatement );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
|
eventMonitor.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
|
||||||
jdbcEventHandler.jdbcPrepareStatementEnd();
|
jdbcEventHandler.jdbcPrepareStatementEnd();
|
||||||
}
|
}
|
||||||
postProcess( preparedStatement );
|
postProcess( preparedStatement );
|
||||||
|
|
|
@ -14,8 +14,8 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.jdbc.spi.ResultSetReturn;
|
import org.hibernate.engine.jdbc.spi.ResultSetReturn;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
||||||
|
|
||||||
|
@ -50,15 +50,15 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final ResultSet rs;
|
final ResultSet rs;
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventManager();
|
||||||
final HibernateMonitoringEvent executionEvent =
|
final DiagnosticEvent executionEvent =
|
||||||
eventManager.beginJdbcPreparedStatementExecutionEvent();
|
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
jdbcExecuteStatementStart();
|
jdbcExecuteStatementStart();
|
||||||
rs = statement.executeQuery();
|
rs = statement.executeQuery();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
jdbcExecuteStatementEnd();
|
jdbcExecuteStatementEnd();
|
||||||
endSlowQueryLogging(sql, executeStartNanos);
|
endSlowQueryLogging(sql, executeStartNanos);
|
||||||
}
|
}
|
||||||
|
@ -70,8 +70,8 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EventManager getEventManager() {
|
private EventMonitor getEventManager() {
|
||||||
return jdbcCoordinator.getJdbcSessionOwner().getEventManager();
|
return jdbcCoordinator.getJdbcSessionOwner().getEventMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private JdbcEventHandler getEventHandler() {
|
private JdbcEventHandler getEventHandler() {
|
||||||
|
@ -96,15 +96,15 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
long executeStartNanos = beginSlowQueryLogging();
|
long executeStartNanos = beginSlowQueryLogging();
|
||||||
try {
|
try {
|
||||||
final ResultSet rs;
|
final ResultSet rs;
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventManager();
|
||||||
final HibernateMonitoringEvent executionEvent =
|
final DiagnosticEvent executionEvent =
|
||||||
eventManager.beginJdbcPreparedStatementExecutionEvent();
|
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
jdbcExecuteStatementStart();
|
jdbcExecuteStatementStart();
|
||||||
rs = statement.executeQuery( sql );
|
rs = statement.executeQuery( sql );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
jdbcExecuteStatementEnd();
|
jdbcExecuteStatementEnd();
|
||||||
endSlowQueryLogging( sql, executeStartNanos );
|
endSlowQueryLogging( sql, executeStartNanos );
|
||||||
}
|
}
|
||||||
|
@ -122,9 +122,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
long executeStartNanos = beginSlowQueryLogging();
|
long executeStartNanos = beginSlowQueryLogging();
|
||||||
try {
|
try {
|
||||||
final ResultSet rs;
|
final ResultSet rs;
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventManager();
|
||||||
final HibernateMonitoringEvent executionEvent =
|
final DiagnosticEvent executionEvent =
|
||||||
eventManager.beginJdbcPreparedStatementExecutionEvent();
|
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
jdbcExecuteStatementStart();
|
jdbcExecuteStatementStart();
|
||||||
if ( !statement.execute() ) {
|
if ( !statement.execute() ) {
|
||||||
|
@ -135,7 +135,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
rs = statement.getResultSet();
|
rs = statement.getResultSet();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
jdbcExecuteStatementEnd();
|
jdbcExecuteStatementEnd();
|
||||||
endSlowQueryLogging( sql, executeStartNanos );
|
endSlowQueryLogging( sql, executeStartNanos );
|
||||||
}
|
}
|
||||||
|
@ -153,9 +153,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
long executeStartNanos = beginSlowQueryLogging();
|
long executeStartNanos = beginSlowQueryLogging();
|
||||||
try {
|
try {
|
||||||
final ResultSet rs;
|
final ResultSet rs;
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventManager();
|
||||||
final HibernateMonitoringEvent executionEvent =
|
final DiagnosticEvent executionEvent =
|
||||||
eventManager.beginJdbcPreparedStatementExecutionEvent();
|
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
jdbcExecuteStatementStart();
|
jdbcExecuteStatementStart();
|
||||||
if ( !statement.execute( sql ) ) {
|
if ( !statement.execute( sql ) ) {
|
||||||
|
@ -166,7 +166,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
rs = statement.getResultSet();
|
rs = statement.getResultSet();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
jdbcExecuteStatementEnd();
|
jdbcExecuteStatementEnd();
|
||||||
endSlowQueryLogging( sql, executeStartNanos );
|
endSlowQueryLogging( sql, executeStartNanos );
|
||||||
}
|
}
|
||||||
|
@ -182,9 +182,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
public int executeUpdate(PreparedStatement statement, String sql) {
|
public int executeUpdate(PreparedStatement statement, String sql) {
|
||||||
assert statement != null;
|
assert statement != null;
|
||||||
long executeStartNanos = beginSlowQueryLogging();
|
long executeStartNanos = beginSlowQueryLogging();
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventManager();
|
||||||
final HibernateMonitoringEvent executionEvent =
|
final DiagnosticEvent executionEvent =
|
||||||
eventManager.beginJdbcPreparedStatementExecutionEvent();
|
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
jdbcExecuteStatementStart();
|
jdbcExecuteStatementStart();
|
||||||
return statement.executeUpdate();
|
return statement.executeUpdate();
|
||||||
|
@ -193,7 +193,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
throw sqlExceptionHelper.convert( e, "could not execute statement", sql );
|
throw sqlExceptionHelper.convert( e, "could not execute statement", sql );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
jdbcExecuteStatementEnd();
|
jdbcExecuteStatementEnd();
|
||||||
endSlowQueryLogging( sql, executeStartNanos );
|
endSlowQueryLogging( sql, executeStartNanos );
|
||||||
}
|
}
|
||||||
|
@ -203,9 +203,9 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
public int executeUpdate(Statement statement, String sql) {
|
public int executeUpdate(Statement statement, String sql) {
|
||||||
sqlStatementLogger.logStatement( sql );
|
sqlStatementLogger.logStatement( sql );
|
||||||
long executeStartNanos = beginSlowQueryLogging();
|
long executeStartNanos = beginSlowQueryLogging();
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventManager();
|
||||||
final HibernateMonitoringEvent executionEvent =
|
final DiagnosticEvent executionEvent =
|
||||||
eventManager.beginJdbcPreparedStatementExecutionEvent();
|
eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
jdbcExecuteStatementStart();
|
jdbcExecuteStatementStart();
|
||||||
return statement.executeUpdate( sql );
|
return statement.executeUpdate( sql );
|
||||||
|
@ -214,7 +214,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
throw sqlExceptionHelper.convert( e, "could not execute statement", sql );
|
throw sqlExceptionHelper.convert( e, "could not execute statement", sql );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
jdbcExecuteStatementEnd();
|
jdbcExecuteStatementEnd();
|
||||||
endSlowQueryLogging( sql, executeStartNanos );
|
endSlowQueryLogging( sql, executeStartNanos );
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ import org.hibernate.ScrollMode;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||||
import org.hibernate.engine.jdbc.spi.StatementPreparer;
|
import org.hibernate.engine.jdbc.spi.StatementPreparer;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
||||||
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
||||||
|
@ -171,15 +171,15 @@ class StatementPreparerImpl implements StatementPreparer {
|
||||||
final PreparedStatement preparedStatement;
|
final PreparedStatement preparedStatement;
|
||||||
final JdbcSessionOwner jdbcSessionOwner = jdbcCoordinator.getJdbcSessionOwner();
|
final JdbcSessionOwner jdbcSessionOwner = jdbcCoordinator.getJdbcSessionOwner();
|
||||||
final JdbcEventHandler observer = jdbcSessionOwner.getJdbcSessionContext().getEventHandler();
|
final JdbcEventHandler observer = jdbcSessionOwner.getJdbcSessionContext().getEventHandler();
|
||||||
final EventManager eventManager = jdbcSessionOwner.getEventManager();
|
final EventMonitor eventMonitor = jdbcSessionOwner.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcPreparedStatementCreation = eventManager.beginJdbcPreparedStatementCreationEvent();
|
final DiagnosticEvent jdbcPreparedStatementCreation = eventMonitor.beginJdbcPreparedStatementCreationEvent();
|
||||||
try {
|
try {
|
||||||
observer.jdbcPrepareStatementStart();
|
observer.jdbcPrepareStatementStart();
|
||||||
preparedStatement = doPrepare();
|
preparedStatement = doPrepare();
|
||||||
setStatementTimeout( preparedStatement );
|
setStatementTimeout( preparedStatement );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
|
eventMonitor.completeJdbcPreparedStatementCreationEvent( jdbcPreparedStatementCreation, sql );
|
||||||
observer.jdbcPrepareStatementEnd();
|
observer.jdbcPrepareStatementEnd();
|
||||||
}
|
}
|
||||||
postProcess( preparedStatement );
|
postProcess( preparedStatement );
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.hibernate.engine.jdbc.LobCreator;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
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.event.spi.EventSource;
|
||||||
import org.hibernate.graph.RootGraph;
|
import org.hibernate.graph.RootGraph;
|
||||||
import org.hibernate.graph.spi.RootGraphImplementor;
|
import org.hibernate.graph.spi.RootGraphImplementor;
|
||||||
|
@ -1168,8 +1168,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventManager getEventManager() {
|
public EventMonitor getEventMonitor() {
|
||||||
return delegate.getEventManager();
|
return delegate.getEventMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.hibernate.engine.jdbc.LobCreator;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
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.graph.RootGraph;
|
||||||
import org.hibernate.jdbc.ReturningWork;
|
import org.hibernate.jdbc.ReturningWork;
|
||||||
import org.hibernate.jdbc.Work;
|
import org.hibernate.jdbc.Work;
|
||||||
|
@ -329,8 +329,8 @@ public class SharedSessionDelegatorBaseImpl implements SharedSessionContractImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventManager getEventManager() {
|
public EventMonitor getEventMonitor() {
|
||||||
return delegate.getEventManager();
|
return delegate.getEventMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,8 +11,8 @@ import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.event.spi.AutoFlushEvent;
|
import org.hibernate.event.spi.AutoFlushEvent;
|
||||||
import org.hibernate.event.spi.AutoFlushEventListener;
|
import org.hibernate.event.spi.AutoFlushEventListener;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||||
|
@ -40,8 +40,8 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
|
||||||
public void onAutoFlush(AutoFlushEvent event) throws HibernateException {
|
public void onAutoFlush(AutoFlushEvent event) throws HibernateException {
|
||||||
final EventSource source = event.getSession();
|
final EventSource source = event.getSession();
|
||||||
final SessionEventListenerManager eventListenerManager = source.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = source.getEventListenerManager();
|
||||||
final EventManager eventManager = source.getEventManager();
|
final EventMonitor eventMonitor = source.getEventMonitor();
|
||||||
final HibernateMonitoringEvent partialFlushEvent = eventManager.beginPartialFlushEvent();
|
final DiagnosticEvent partialFlushEvent = eventMonitor.beginPartialFlushEvent();
|
||||||
try {
|
try {
|
||||||
eventListenerManager.partialFlushStart();
|
eventListenerManager.partialFlushStart();
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
|
||||||
|
|
||||||
// note: performExecutions() clears all collectionXxxxtion
|
// note: performExecutions() clears all collectionXxxxtion
|
||||||
// collections (the collection actions) in the session
|
// collections (the collection actions) in the session
|
||||||
final HibernateMonitoringEvent flushEvent = eventManager.beginFlushEvent();
|
final DiagnosticEvent flushEvent = eventMonitor.beginFlushEvent();
|
||||||
try {
|
try {
|
||||||
performExecutions( source );
|
performExecutions( source );
|
||||||
postFlush( source );
|
postFlush( source );
|
||||||
|
@ -70,7 +70,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
|
||||||
postPostFlush( source );
|
postPostFlush( source );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeFlushEvent( flushEvent, event, true );
|
eventMonitor.completeFlushEvent( flushEvent, event, true );
|
||||||
}
|
}
|
||||||
final StatisticsImplementor statistics = source.getFactory().getStatistics();
|
final StatisticsImplementor statistics = source.getFactory().getStatistics();
|
||||||
if ( statistics.isStatisticsEnabled() ) {
|
if ( statistics.isStatisticsEnabled() ) {
|
||||||
|
@ -85,7 +85,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completePartialFlushEvent( partialFlushEvent, event );
|
eventMonitor.completePartialFlushEvent( partialFlushEvent, event );
|
||||||
eventListenerManager.partialFlushEnd(
|
eventListenerManager.partialFlushEnd(
|
||||||
event.getNumberOfEntitiesProcessed(),
|
event.getNumberOfEntitiesProcessed(),
|
||||||
event.getNumberOfEntitiesProcessed()
|
event.getNumberOfEntitiesProcessed()
|
||||||
|
@ -97,15 +97,15 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener
|
||||||
public void onAutoPreFlush(EventSource source) throws HibernateException {
|
public void onAutoPreFlush(EventSource source) throws HibernateException {
|
||||||
final SessionEventListenerManager eventListenerManager = source.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = source.getEventListenerManager();
|
||||||
eventListenerManager.prePartialFlushStart();
|
eventListenerManager.prePartialFlushStart();
|
||||||
final EventManager eventManager = source.getEventManager();
|
final EventMonitor eventMonitor = source.getEventMonitor();
|
||||||
HibernateMonitoringEvent hibernateMonitoringEvent = eventManager.beginPrePartialFlush();
|
DiagnosticEvent diagnosticEvent = eventMonitor.beginPrePartialFlush();
|
||||||
try {
|
try {
|
||||||
if ( flushMightBeNeeded( source ) ) {
|
if ( flushMightBeNeeded( source ) ) {
|
||||||
preFlush( source, source.getPersistenceContextInternal() );
|
preFlush( source, source.getPersistenceContextInternal() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completePrePartialFlush( hibernateMonitoringEvent, source );
|
eventMonitor.completePrePartialFlush( diagnosticEvent, source );
|
||||||
eventListenerManager.prePartialFlushEnd();
|
eventListenerManager.prePartialFlushEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ import org.hibernate.engine.spi.SelfDirtinessTracker;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.Status;
|
import org.hibernate.engine.spi.Status;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
import org.hibernate.event.spi.FlushEntityEvent;
|
import org.hibernate.event.spi.FlushEntityEvent;
|
||||||
import org.hibernate.event.spi.FlushEntityEventListener;
|
import org.hibernate.event.spi.FlushEntityEventListener;
|
||||||
|
@ -472,8 +472,8 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
||||||
final SessionImplementor session = event.getSession();
|
final SessionImplementor session = event.getSession();
|
||||||
final boolean dirtyCheckPossible;
|
final boolean dirtyCheckPossible;
|
||||||
int[] dirtyProperties = null;
|
int[] dirtyProperties = null;
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent dirtyCalculationEvent = eventManager.beginDirtyCalculationEvent();
|
final DiagnosticEvent dirtyCalculationEvent = eventMonitor.beginDirtyCalculationEvent();
|
||||||
final EntityEntry entry = event.getEntityEntry();
|
final EntityEntry entry = event.getEntityEntry();
|
||||||
final EntityPersister persister = entry.getPersister();
|
final EntityPersister persister = entry.getPersister();
|
||||||
try {
|
try {
|
||||||
|
@ -524,7 +524,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
||||||
event.setDirtyCheckPossible( dirtyCheckPossible );
|
event.setDirtyCheckPossible( dirtyCheckPossible );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeDirtyCalculationEvent( dirtyCalculationEvent, session, persister, entry, dirtyProperties );
|
eventMonitor.completeDirtyCalculationEvent( dirtyCalculationEvent, session, persister, entry, dirtyProperties );
|
||||||
session.getEventListenerManager().dirtyCalculationEnd( dirtyProperties != null );
|
session.getEventListenerManager().dirtyCalculationEnd( dirtyProperties != null );
|
||||||
}
|
}
|
||||||
return dirtyProperties;
|
return dirtyProperties;
|
||||||
|
|
|
@ -6,8 +6,8 @@ package org.hibernate.event.internal;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.engine.spi.PersistenceContext;
|
import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
import org.hibernate.event.spi.FlushEvent;
|
import org.hibernate.event.spi.FlushEvent;
|
||||||
import org.hibernate.event.spi.FlushEventListener;
|
import org.hibernate.event.spi.FlushEventListener;
|
||||||
|
@ -28,10 +28,10 @@ public class DefaultFlushEventListener extends AbstractFlushingEventListener imp
|
||||||
public void onFlush(FlushEvent event) throws HibernateException {
|
public void onFlush(FlushEvent event) throws HibernateException {
|
||||||
final EventSource source = event.getSession();
|
final EventSource source = event.getSession();
|
||||||
final PersistenceContext persistenceContext = source.getPersistenceContextInternal();
|
final PersistenceContext persistenceContext = source.getPersistenceContextInternal();
|
||||||
final EventManager eventManager = source.getEventManager();
|
final EventMonitor eventMonitor = source.getEventMonitor();
|
||||||
if ( persistenceContext.getNumberOfManagedEntities() > 0
|
if ( persistenceContext.getNumberOfManagedEntities() > 0
|
||||||
|| persistenceContext.getCollectionEntriesSize() > 0 ) {
|
|| persistenceContext.getCollectionEntriesSize() > 0 ) {
|
||||||
final HibernateMonitoringEvent flushEvent = eventManager.beginFlushEvent();
|
final DiagnosticEvent flushEvent = eventMonitor.beginFlushEvent();
|
||||||
try {
|
try {
|
||||||
source.getEventListenerManager().flushStart();
|
source.getEventListenerManager().flushStart();
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class DefaultFlushEventListener extends AbstractFlushingEventListener imp
|
||||||
postFlush( source );
|
postFlush( source );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeFlushEvent( flushEvent, event );
|
eventMonitor.completeFlushEvent( flushEvent, event );
|
||||||
source.getEventListenerManager().flushEnd(
|
source.getEventListenerManager().flushEnd(
|
||||||
event.getNumberOfEntitiesProcessed(),
|
event.getNumberOfEntitiesProcessed(),
|
||||||
event.getNumberOfCollectionsProcessed()
|
event.getNumberOfCollectionsProcessed()
|
||||||
|
|
|
@ -10,107 +10,107 @@ import org.hibernate.cache.spi.access.CachedDomainDataAccess;
|
||||||
import org.hibernate.engine.spi.EntityEntry;
|
import org.hibernate.engine.spi.EntityEntry;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.AutoFlushEvent;
|
import org.hibernate.event.spi.AutoFlushEvent;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.FlushEvent;
|
import org.hibernate.event.spi.FlushEvent;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
@Override
|
||||||
public HibernateMonitoringEvent beginSessionOpenEvent() {
|
public DiagnosticEvent beginSessionOpenEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeSessionOpenEvent(HibernateMonitoringEvent sessionOpenEvent, SharedSessionContractImplementor session) {
|
public void completeSessionOpenEvent(DiagnosticEvent sessionOpenEvent, SharedSessionContractImplementor session) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginSessionClosedEvent() {
|
public DiagnosticEvent beginSessionClosedEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeSessionClosedEvent(
|
public void completeSessionClosedEvent(
|
||||||
HibernateMonitoringEvent sessionClosedEvent,
|
DiagnosticEvent sessionClosedEvent,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginJdbcConnectionAcquisitionEvent() {
|
public DiagnosticEvent beginJdbcConnectionAcquisitionEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcConnectionAcquisitionEvent(
|
public void completeJdbcConnectionAcquisitionEvent(
|
||||||
HibernateMonitoringEvent jdbcConnectionAcquisitionEvent,
|
DiagnosticEvent jdbcConnectionAcquisitionEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Object tenantId) {
|
Object tenantId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginJdbcConnectionReleaseEvent() {
|
public DiagnosticEvent beginJdbcConnectionReleaseEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcConnectionReleaseEvent(
|
public void completeJdbcConnectionReleaseEvent(
|
||||||
HibernateMonitoringEvent jdbcConnectionReleaseEvent,
|
DiagnosticEvent jdbcConnectionReleaseEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Object tenantId) {
|
Object tenantId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginJdbcPreparedStatementCreationEvent() {
|
public DiagnosticEvent beginJdbcPreparedStatementCreationEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcPreparedStatementCreationEvent(
|
public void completeJdbcPreparedStatementCreationEvent(
|
||||||
HibernateMonitoringEvent jdbcPreparedStatementCreation,
|
DiagnosticEvent jdbcPreparedStatementCreation,
|
||||||
String preparedStatementSql) {
|
String preparedStatementSql) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginJdbcPreparedStatementExecutionEvent() {
|
public DiagnosticEvent beginJdbcPreparedStatementExecutionEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcPreparedStatementExecutionEvent(
|
public void completeJdbcPreparedStatementExecutionEvent(
|
||||||
HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent,
|
DiagnosticEvent jdbcPreparedStatementExecutionEvent,
|
||||||
String preparedStatementSql) {
|
String preparedStatementSql) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginJdbcBatchExecutionEvent() {
|
public DiagnosticEvent beginJdbcBatchExecutionEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcBatchExecutionEvent(HibernateMonitoringEvent jdbcBatchExecutionEvent, String statementSql) {
|
public void completeJdbcBatchExecutionEvent(DiagnosticEvent jdbcBatchExecutionEvent, String statementSql) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginCachePutEvent() {
|
public DiagnosticEvent beginCachePutEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent cachePutEvent,
|
DiagnosticEvent cachePutEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
boolean cacheContentChanged,
|
boolean cacheContentChanged,
|
||||||
|
@ -120,7 +120,7 @@ public final class EmptyEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent cachePutEvent,
|
DiagnosticEvent cachePutEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -131,7 +131,7 @@ public final class EmptyEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent cachePutEvent,
|
DiagnosticEvent cachePutEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -143,7 +143,7 @@ public final class EmptyEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent cachePutEvent,
|
DiagnosticEvent cachePutEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
CollectionPersister persister,
|
CollectionPersister persister,
|
||||||
|
@ -153,13 +153,13 @@ public final class EmptyEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginCacheGetEvent() {
|
public DiagnosticEvent beginCacheGetEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent cacheGetEvent,
|
DiagnosticEvent cacheGetEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
boolean hit) {
|
boolean hit) {
|
||||||
|
@ -168,7 +168,7 @@ public final class EmptyEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent cacheGetEvent,
|
DiagnosticEvent cacheGetEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -179,7 +179,7 @@ public final class EmptyEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent cacheGetEvent,
|
DiagnosticEvent cacheGetEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
CollectionPersister persister,
|
CollectionPersister persister,
|
||||||
|
@ -188,38 +188,38 @@ public final class EmptyEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginFlushEvent() {
|
public DiagnosticEvent beginFlushEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeFlushEvent(HibernateMonitoringEvent flushEvent, FlushEvent event) {
|
public void completeFlushEvent(DiagnosticEvent flushEvent, FlushEvent event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeFlushEvent(HibernateMonitoringEvent flushEvent, FlushEvent event, boolean autoFlush) {
|
public void completeFlushEvent(DiagnosticEvent flushEvent, FlushEvent event, boolean autoFlush) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginPartialFlushEvent() {
|
public DiagnosticEvent beginPartialFlushEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completePartialFlushEvent(HibernateMonitoringEvent flushEvent, AutoFlushEvent event) {
|
public void completePartialFlushEvent(DiagnosticEvent flushEvent, AutoFlushEvent event) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginDirtyCalculationEvent() {
|
public DiagnosticEvent beginDirtyCalculationEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeDirtyCalculationEvent(
|
public void completeDirtyCalculationEvent(
|
||||||
HibernateMonitoringEvent dirtyCalculationEvent,
|
DiagnosticEvent dirtyCalculationEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
EntityEntry entry,
|
EntityEntry entry,
|
||||||
|
@ -228,25 +228,25 @@ public final class EmptyEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginPrePartialFlush() {
|
public DiagnosticEvent beginPrePartialFlush() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completePrePartialFlush(
|
public void completePrePartialFlush(
|
||||||
HibernateMonitoringEvent prePartialFlush,
|
DiagnosticEvent prePartialFlush,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityInsertEvent() {
|
public DiagnosticEvent beginEntityInsertEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeEntityInsertEvent(
|
public void completeEntityInsertEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String entityName,
|
Object id, String entityName,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -254,13 +254,13 @@ public final class EmptyEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityUpdateEvent() {
|
public DiagnosticEvent beginEntityUpdateEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeEntityUpdateEvent(
|
public void completeEntityUpdateEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String entityName,
|
Object id, String entityName,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -268,23 +268,23 @@ public final class EmptyEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityUpsertEvent() {
|
public DiagnosticEvent beginEntityUpsertEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityDeleteEvent() {
|
public DiagnosticEvent beginEntityDeleteEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeEntityDeleteEvent(
|
public void completeEntityDeleteEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String entityName,
|
Object id, String entityName,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -292,42 +292,42 @@ public final class EmptyEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityLockEvent() {
|
public DiagnosticEvent beginEntityLockEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
public HibernateMonitoringEvent beginCollectionRecreateEvent() {
|
public DiagnosticEvent beginCollectionRecreateEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
public HibernateMonitoringEvent beginCollectionUpdateEvent() {
|
public DiagnosticEvent beginCollectionUpdateEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
public HibernateMonitoringEvent beginCollectionRemoveEvent() {
|
public DiagnosticEvent beginCollectionRemoveEvent() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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 {
|
||||||
|
}
|
|
@ -4,226 +4,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.spi;
|
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
|
* @deprecated Renamed {@link EventMonitor}.
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
@JavaServiceLoadable
|
@Deprecated(since = "7", forRemoval = true)
|
||||||
@Incubating
|
public interface EventManager extends EventMonitor {
|
||||||
public interface EventManager {
|
|
||||||
HibernateMonitoringEvent beginSessionOpenEvent();
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,8 +4,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.spi;
|
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 {
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ import org.hibernate.engine.jdbc.internal.FormatStyle;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.generator.GeneratorCreationContext;
|
import org.hibernate.generator.GeneratorCreationContext;
|
||||||
import org.hibernate.id.ExportableColumn;
|
import org.hibernate.id.ExportableColumn;
|
||||||
import org.hibernate.id.IdentifierGeneratorHelper;
|
import org.hibernate.id.IdentifierGeneratorHelper;
|
||||||
|
@ -623,8 +623,8 @@ public class TableGenerator implements PersistentIdentifierGenerator {
|
||||||
SessionEventListenerManager listener,
|
SessionEventListenerManager listener,
|
||||||
SharedSessionContractImplementor session) throws SQLException {
|
SharedSessionContractImplementor session) throws SQLException {
|
||||||
logger.logStatement( sql, FormatStyle.BASIC.getFormatter() );
|
logger.logStatement( sql, FormatStyle.BASIC.getFormatter() );
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent creationEvent = eventManager.beginJdbcPreparedStatementCreationEvent();
|
final DiagnosticEvent creationEvent = eventMonitor.beginJdbcPreparedStatementCreationEvent();
|
||||||
final StatisticsImplementor stats = session.getFactory().getStatistics();
|
final StatisticsImplementor stats = session.getFactory().getStatistics();
|
||||||
try {
|
try {
|
||||||
listener.jdbcPrepareStatementStart();
|
listener.jdbcPrepareStatementStart();
|
||||||
|
@ -634,7 +634,7 @@ public class TableGenerator implements PersistentIdentifierGenerator {
|
||||||
return connection.prepareStatement( sql );
|
return connection.prepareStatement( sql );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementCreationEvent( creationEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementCreationEvent( creationEvent, sql );
|
||||||
listener.jdbcPrepareStatementEnd();
|
listener.jdbcPrepareStatementEnd();
|
||||||
if ( stats != null && stats.isStatisticsEnabled() ) {
|
if ( stats != null && stats.isStatisticsEnabled() ) {
|
||||||
stats.closeStatement();
|
stats.closeStatement();
|
||||||
|
@ -647,14 +647,14 @@ public class TableGenerator implements PersistentIdentifierGenerator {
|
||||||
SessionEventListenerManager listener,
|
SessionEventListenerManager listener,
|
||||||
String sql,
|
String sql,
|
||||||
SharedSessionContractImplementor session) throws SQLException {
|
SharedSessionContractImplementor session) throws SQLException {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent();
|
final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
listener.jdbcExecuteStatementStart();
|
listener.jdbcExecuteStatementStart();
|
||||||
return ps.executeUpdate();
|
return ps.executeUpdate();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
listener.jdbcExecuteStatementEnd();
|
listener.jdbcExecuteStatementEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -664,14 +664,14 @@ public class TableGenerator implements PersistentIdentifierGenerator {
|
||||||
SessionEventListenerManager listener,
|
SessionEventListenerManager listener,
|
||||||
String sql,
|
String sql,
|
||||||
SharedSessionContractImplementor session) throws SQLException {
|
SharedSessionContractImplementor session) throws SQLException {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent();
|
final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
listener.jdbcExecuteStatementStart();
|
listener.jdbcExecuteStatementStart();
|
||||||
return ps.executeQuery();
|
return ps.executeQuery();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
listener.jdbcExecuteStatementEnd();
|
listener.jdbcExecuteStatementEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ import org.hibernate.engine.jdbc.internal.FormatStyle;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.id.ExportableColumn;
|
import org.hibernate.id.ExportableColumn;
|
||||||
import org.hibernate.id.IdentifierGenerationException;
|
import org.hibernate.id.IdentifierGenerationException;
|
||||||
import org.hibernate.id.IntegralDataTypeHolder;
|
import org.hibernate.id.IntegralDataTypeHolder;
|
||||||
|
@ -237,8 +237,8 @@ public class TableStructure implements DatabaseStructure {
|
||||||
SessionEventListenerManager statsCollector,
|
SessionEventListenerManager statsCollector,
|
||||||
SharedSessionContractImplementor session) throws SQLException {
|
SharedSessionContractImplementor session) throws SQLException {
|
||||||
logger.logStatement( sql, FormatStyle.BASIC.getFormatter() );
|
logger.logStatement( sql, FormatStyle.BASIC.getFormatter() );
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent creationEvent = eventManager.beginJdbcPreparedStatementCreationEvent();
|
final DiagnosticEvent creationEvent = eventMonitor.beginJdbcPreparedStatementCreationEvent();
|
||||||
final StatisticsImplementor stats = session.getFactory().getStatistics();
|
final StatisticsImplementor stats = session.getFactory().getStatistics();
|
||||||
try {
|
try {
|
||||||
statsCollector.jdbcPrepareStatementStart();
|
statsCollector.jdbcPrepareStatementStart();
|
||||||
|
@ -248,7 +248,7 @@ public class TableStructure implements DatabaseStructure {
|
||||||
return connection.prepareStatement( sql );
|
return connection.prepareStatement( sql );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementCreationEvent( creationEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementCreationEvent( creationEvent, sql );
|
||||||
statsCollector.jdbcPrepareStatementEnd();
|
statsCollector.jdbcPrepareStatementEnd();
|
||||||
if ( stats != null && stats.isStatisticsEnabled() ) {
|
if ( stats != null && stats.isStatisticsEnabled() ) {
|
||||||
stats.closeStatement();
|
stats.closeStatement();
|
||||||
|
@ -261,14 +261,14 @@ public class TableStructure implements DatabaseStructure {
|
||||||
SessionEventListenerManager statsCollector,
|
SessionEventListenerManager statsCollector,
|
||||||
String sql,
|
String sql,
|
||||||
SharedSessionContractImplementor session) throws SQLException {
|
SharedSessionContractImplementor session) throws SQLException {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent();
|
final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
statsCollector.jdbcExecuteStatementStart();
|
statsCollector.jdbcExecuteStatementStart();
|
||||||
return ps.executeUpdate();
|
return ps.executeUpdate();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
statsCollector.jdbcExecuteStatementEnd();
|
statsCollector.jdbcExecuteStatementEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,14 +279,14 @@ public class TableStructure implements DatabaseStructure {
|
||||||
SessionEventListenerManager statsCollector,
|
SessionEventListenerManager statsCollector,
|
||||||
String sql,
|
String sql,
|
||||||
SharedSessionContractImplementor session) throws SQLException {
|
SharedSessionContractImplementor session) throws SQLException {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent executionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent();
|
final DiagnosticEvent executionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
statsCollector.jdbcExecuteStatementStart();
|
statsCollector.jdbcExecuteStatementStart();
|
||||||
return ps.executeQuery();
|
return ps.executeQuery();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( executionEvent, sql );
|
||||||
statsCollector.jdbcExecuteStatementEnd();
|
statsCollector.jdbcExecuteStatementEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.engine.transaction.internal.TransactionImpl;
|
import org.hibernate.engine.transaction.internal.TransactionImpl;
|
||||||
import org.hibernate.engine.transaction.spi.TransactionImplementor;
|
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.RootGraph;
|
||||||
import org.hibernate.graph.internal.RootGraphImpl;
|
import org.hibernate.graph.internal.RootGraphImpl;
|
||||||
import org.hibernate.graph.spi.RootGraphImplementor;
|
import org.hibernate.graph.spi.RootGraphImplementor;
|
||||||
|
@ -1435,8 +1435,8 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventManager getEventManager() {
|
public EventMonitor getEventMonitor() {
|
||||||
return fastSessionServices.eventManager;
|
return fastSessionServices.eventMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.hibernate.SessionEventListener;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
|
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -43,14 +43,14 @@ public class ContextualJdbcConnectionAccess implements JdbcConnectionAccess, Ser
|
||||||
throw new HibernateException( "Tenant identifier required" );
|
throw new HibernateException( "Tenant identifier required" );
|
||||||
}
|
}
|
||||||
|
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcConnectionAcquisitionEvent = eventManager.beginJdbcConnectionAcquisitionEvent();
|
final DiagnosticEvent jdbcConnectionAcquisitionEvent = eventMonitor.beginJdbcConnectionAcquisitionEvent();
|
||||||
try {
|
try {
|
||||||
listener.jdbcConnectionAcquisitionStart();
|
listener.jdbcConnectionAcquisitionStart();
|
||||||
return connectionProvider.getConnection( tenantIdentifier );
|
return connectionProvider.getConnection( tenantIdentifier );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcConnectionAcquisitionEvent(
|
eventMonitor.completeJdbcConnectionAcquisitionEvent(
|
||||||
jdbcConnectionAcquisitionEvent,
|
jdbcConnectionAcquisitionEvent,
|
||||||
session,
|
session,
|
||||||
tenantIdentifier
|
tenantIdentifier
|
||||||
|
@ -65,14 +65,14 @@ public class ContextualJdbcConnectionAccess implements JdbcConnectionAccess, Ser
|
||||||
throw new HibernateException( "Tenant identifier required" );
|
throw new HibernateException( "Tenant identifier required" );
|
||||||
}
|
}
|
||||||
|
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcConnectionReleaseEvent = eventManager.beginJdbcConnectionReleaseEvent();
|
final DiagnosticEvent jdbcConnectionReleaseEvent = eventMonitor.beginJdbcConnectionReleaseEvent();
|
||||||
try {
|
try {
|
||||||
listener.jdbcConnectionReleaseStart();
|
listener.jdbcConnectionReleaseStart();
|
||||||
connectionProvider.releaseConnection( tenantIdentifier, connection );
|
connectionProvider.releaseConnection( tenantIdentifier, connection );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, tenantIdentifier );
|
eventMonitor.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, tenantIdentifier );
|
||||||
listener.jdbcConnectionReleaseEnd();
|
listener.jdbcConnectionReleaseEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.connections.spi.MultiTenantConnectionProvider;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
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.EventListenerGroup;
|
||||||
import org.hibernate.event.service.spi.EventListenerRegistry;
|
import org.hibernate.event.service.spi.EventListenerRegistry;
|
||||||
import org.hibernate.event.spi.*;
|
import org.hibernate.event.spi.*;
|
||||||
|
@ -125,7 +125,7 @@ public final class FastSessionServices {
|
||||||
final MultiTenantConnectionProvider<Object> multiTenantConnectionProvider;
|
final MultiTenantConnectionProvider<Object> multiTenantConnectionProvider;
|
||||||
final ClassLoaderService classLoaderService;
|
final ClassLoaderService classLoaderService;
|
||||||
final TransactionCoordinatorBuilder transactionCoordinatorBuilder;
|
final TransactionCoordinatorBuilder transactionCoordinatorBuilder;
|
||||||
final EventManager eventManager;
|
final EventMonitor eventMonitor;
|
||||||
final boolean isJtaTransactionAccessible;
|
final boolean isJtaTransactionAccessible;
|
||||||
final CacheMode initialSessionCacheMode;
|
final CacheMode initialSessionCacheMode;
|
||||||
final FlushMode initialSessionFlushMode;
|
final FlushMode initialSessionFlushMode;
|
||||||
|
@ -235,8 +235,8 @@ public final class FastSessionServices {
|
||||||
this.xmlFormatMapper = sessionFactoryOptions.getXmlFormatMapper();
|
this.xmlFormatMapper = sessionFactoryOptions.getXmlFormatMapper();
|
||||||
this.batchBuilder = serviceRegistry.getService( BatchBuilder.class );
|
this.batchBuilder = serviceRegistry.getService( BatchBuilder.class );
|
||||||
|
|
||||||
final Collection<EventManager> eventManagers = classLoaderService.loadJavaServices( EventManager.class );
|
final Collection<EventMonitor> eventMonitors = classLoaderService.loadJavaServices( EventMonitor.class );
|
||||||
this.eventManager = eventManagers.isEmpty() ? new EmptyEventManager() : eventManagers.iterator().next();
|
this.eventMonitor = eventMonitors.isEmpty() ? new EmptyEventMonitor() : eventMonitors.iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FlushMode initializeDefaultFlushMode(Map<String, Object> defaultSessionProperties) {
|
private static FlushMode initializeDefaultFlushMode(Map<String, Object> defaultSessionProperties) {
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.hibernate.SessionEventListener;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -37,14 +37,14 @@ public class NonContextualJdbcConnectionAccess implements JdbcConnectionAccess,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection obtainConnection() throws SQLException {
|
public Connection obtainConnection() throws SQLException {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcConnectionAcquisitionEvent = eventManager.beginJdbcConnectionAcquisitionEvent();
|
final DiagnosticEvent jdbcConnectionAcquisitionEvent = eventMonitor.beginJdbcConnectionAcquisitionEvent();
|
||||||
try {
|
try {
|
||||||
listener.jdbcConnectionAcquisitionStart();
|
listener.jdbcConnectionAcquisitionStart();
|
||||||
return connectionProvider.getConnection();
|
return connectionProvider.getConnection();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcConnectionAcquisitionEvent(
|
eventMonitor.completeJdbcConnectionAcquisitionEvent(
|
||||||
jdbcConnectionAcquisitionEvent,
|
jdbcConnectionAcquisitionEvent,
|
||||||
session,
|
session,
|
||||||
null
|
null
|
||||||
|
@ -55,14 +55,14 @@ public class NonContextualJdbcConnectionAccess implements JdbcConnectionAccess,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releaseConnection(Connection connection) throws SQLException {
|
public void releaseConnection(Connection connection) throws SQLException {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcConnectionReleaseEvent = eventManager.beginJdbcConnectionReleaseEvent();
|
final DiagnosticEvent jdbcConnectionReleaseEvent = eventMonitor.beginJdbcConnectionReleaseEvent();
|
||||||
try {
|
try {
|
||||||
listener.jdbcConnectionReleaseStart();
|
listener.jdbcConnectionReleaseStart();
|
||||||
connectionProvider.closeConnection( connection );
|
connectionProvider.closeConnection( connection );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, null );
|
eventMonitor.completeJdbcConnectionReleaseEvent( jdbcConnectionReleaseEvent, session, null );
|
||||||
listener.jdbcConnectionReleaseEnd();
|
listener.jdbcConnectionReleaseEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,8 @@ import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.engine.transaction.spi.TransactionImplementor;
|
import org.hibernate.engine.transaction.spi.TransactionImplementor;
|
||||||
import org.hibernate.resource.transaction.spi.TransactionObserver;
|
import org.hibernate.resource.transaction.spi.TransactionObserver;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.AutoFlushEvent;
|
import org.hibernate.event.spi.AutoFlushEvent;
|
||||||
import org.hibernate.event.spi.AutoFlushEventListener;
|
import org.hibernate.event.spi.AutoFlushEventListener;
|
||||||
import org.hibernate.event.spi.ClearEvent;
|
import org.hibernate.event.spi.ClearEvent;
|
||||||
|
@ -241,7 +241,7 @@ public class SessionImpl
|
||||||
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) {
|
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) {
|
||||||
super( factory, options );
|
super( factory, options );
|
||||||
|
|
||||||
final HibernateMonitoringEvent sessionOpenEvent = getEventManager().beginSessionOpenEvent();
|
final DiagnosticEvent sessionOpenEvent = getEventMonitor().beginSessionOpenEvent();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
persistenceContext = createPersistenceContext();
|
persistenceContext = createPersistenceContext();
|
||||||
|
@ -280,7 +280,7 @@ public class SessionImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
getEventManager().completeSessionOpenEvent( sessionOpenEvent, this );
|
getEventMonitor().completeSessionOpenEvent( sessionOpenEvent, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,8 +411,8 @@ public class SessionImpl
|
||||||
log.tracef( "Closing session [%s]", getSessionIdentifier() );
|
log.tracef( "Closing session [%s]", getSessionIdentifier() );
|
||||||
}
|
}
|
||||||
|
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent sessionClosedEvent = eventManager.beginSessionClosedEvent();
|
final DiagnosticEvent sessionClosedEvent = eventMonitor.beginSessionClosedEvent();
|
||||||
try {
|
try {
|
||||||
if ( isJpaBootstrap() ) {
|
if ( isJpaBootstrap() ) {
|
||||||
// Original HEM close behavior
|
// Original HEM close behavior
|
||||||
|
@ -437,7 +437,7 @@ public class SessionImpl
|
||||||
if ( statistics.isStatisticsEnabled() ) {
|
if ( statistics.isStatisticsEnabled() ) {
|
||||||
statistics.closeSession();
|
statistics.closeSession();
|
||||||
}
|
}
|
||||||
eventManager.completeSessionClosedEvent( sessionClosedEvent, this );
|
eventMonitor.completeSessionClosedEvent( sessionClosedEvent, this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.PersistenceContext;
|
import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
|
import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
|
||||||
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
|
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.PostDeleteEvent;
|
import org.hibernate.event.spi.PostDeleteEvent;
|
||||||
import org.hibernate.event.spi.PostDeleteEventListener;
|
import org.hibernate.event.spi.PostDeleteEventListener;
|
||||||
import org.hibernate.event.spi.PostInsertEvent;
|
import org.hibernate.event.spi.PostInsertEvent;
|
||||||
|
@ -186,15 +186,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getInterceptor().onInsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
|
getInterceptor().onInsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityInsertEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityInsertEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.getInsertCoordinator().insert( entity, id, state, this );
|
persister.getInsertCoordinator().insert( entity, id, state, this );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
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) {
|
private void recreateCollections(Object entity, Object id, EntityPersister persister) {
|
||||||
forEachOwnedCollection( entity, id, persister,
|
forEachOwnedCollection( entity, id, persister,
|
||||||
(descriptor, collection) -> {
|
(descriptor, collection) -> {
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginCollectionRecreateEvent();
|
final DiagnosticEvent event = eventMonitor.beginCollectionRecreateEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
descriptor.recreate( collection, id, this );
|
descriptor.recreate( collection, id, this );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCollectionRecreateEvent( event, id, descriptor.getRole(), success, this );
|
eventMonitor.completeCollectionRecreateEvent( event, id, descriptor.getRole(), success, this );
|
||||||
}
|
}
|
||||||
final StatisticsImplementor statistics = getFactory().getStatistics();
|
final StatisticsImplementor statistics = getFactory().getStatistics();
|
||||||
if ( statistics.isStatisticsEnabled() ) {
|
if ( statistics.isStatisticsEnabled() ) {
|
||||||
|
@ -257,15 +257,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
if ( !firePreDelete(entity, id, persister) ) {
|
if ( !firePreDelete(entity, id, persister) ) {
|
||||||
getInterceptor().onDelete( entity, id, persister.getPropertyNames(), persister.getPropertyTypes() );
|
getInterceptor().onDelete( entity, id, persister.getPropertyNames(), persister.getPropertyTypes() );
|
||||||
removeCollections( entity, id, persister );
|
removeCollections( entity, id, persister );
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityDeleteEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityDeleteEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.getDeleteCoordinator().delete( entity, id, version, this );
|
persister.getDeleteCoordinator().delete( entity, id, version, this );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, this );
|
eventMonitor.completeEntityDeleteEvent( event, id, persister.getEntityName(), success, this );
|
||||||
}
|
}
|
||||||
firePostDelete(entity, id, persister);
|
firePostDelete(entity, id, persister);
|
||||||
final StatisticsImplementor statistics = getFactory().getStatistics();
|
final StatisticsImplementor statistics = getFactory().getStatistics();
|
||||||
|
@ -278,15 +278,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
private void removeCollections(Object entity, Object id, EntityPersister persister) {
|
private void removeCollections(Object entity, Object id, EntityPersister persister) {
|
||||||
forEachOwnedCollection( entity, id, persister,
|
forEachOwnedCollection( entity, id, persister,
|
||||||
(descriptor, collection) -> {
|
(descriptor, collection) -> {
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent();
|
final DiagnosticEvent event = eventMonitor.beginCollectionRemoveEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
descriptor.remove( id, this );
|
descriptor.remove( id, this );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this );
|
eventMonitor.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
final StatisticsImplementor statistics = getFactory().getStatistics();
|
final StatisticsImplementor statistics = getFactory().getStatistics();
|
||||||
|
@ -336,15 +336,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
}
|
}
|
||||||
if ( !firePreUpdate(entity, id, state, persister) ) {
|
if ( !firePreUpdate(entity, id, state, persister) ) {
|
||||||
getInterceptor().onUpdate( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
|
getInterceptor().onUpdate( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityUpdateEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityUpdateEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.getUpdateCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this );
|
persister.getUpdateCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, this );
|
eventMonitor.completeEntityUpdateEvent( event, id, persister.getEntityName(), success, this );
|
||||||
}
|
}
|
||||||
removeAndRecreateCollections( entity, id, persister );
|
removeAndRecreateCollections( entity, id, persister );
|
||||||
firePostUpdate(entity, id, state, 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) {
|
private void removeAndRecreateCollections(Object entity, Object id, EntityPersister persister) {
|
||||||
forEachOwnedCollection( entity, id, persister,
|
forEachOwnedCollection( entity, id, persister,
|
||||||
(descriptor, collection) -> {
|
(descriptor, collection) -> {
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginCollectionRemoveEvent();
|
final DiagnosticEvent event = eventMonitor.beginCollectionRemoveEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
// TODO: can we do better here?
|
// TODO: can we do better here?
|
||||||
|
@ -368,7 +368,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this );
|
eventMonitor.completeCollectionRemoveEvent( event, id, descriptor.getRole(), success, this );
|
||||||
}
|
}
|
||||||
final StatisticsImplementor statistics = getFactory().getStatistics();
|
final StatisticsImplementor statistics = getFactory().getStatistics();
|
||||||
if ( statistics.isStatisticsEnabled() ) {
|
if ( statistics.isStatisticsEnabled() ) {
|
||||||
|
@ -405,15 +405,15 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
||||||
if ( !firePreUpsert(entity, id, state, persister) ) {
|
if ( !firePreUpsert(entity, id, state, persister) ) {
|
||||||
getInterceptor().onUpsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
|
getInterceptor().onUpsert( entity, id, state, persister.getPropertyNames(), persister.getPropertyTypes() );
|
||||||
final Object oldVersion = versionToUpsert( entity, persister, state );
|
final Object oldVersion = versionToUpsert( entity, persister, state );
|
||||||
final EventManager eventManager = getEventManager();
|
final EventMonitor eventMonitor = getEventMonitor();
|
||||||
final HibernateMonitoringEvent event = eventManager.beginEntityUpsertEvent();
|
final DiagnosticEvent event = eventMonitor.beginEntityUpsertEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.getMergeCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this );
|
persister.getMergeCoordinator().update( entity, id, null, state, oldVersion, null, null, false, this );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityUpsertEvent( event, id, persister.getEntityName(), success, this );
|
eventMonitor.completeEntityUpsertEvent( event, id, persister.getEntityName(), success, this );
|
||||||
}
|
}
|
||||||
final StatisticsImplementor statistics = getFactory().getStatistics();
|
final StatisticsImplementor statistics = getFactory().getStatistics();
|
||||||
if ( statistics.isStatisticsEnabled() ) {
|
if ( statistics.isStatisticsEnabled() ) {
|
||||||
|
|
|
@ -18,9 +18,9 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.engine.spi.SubselectFetch;
|
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.EventSource;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.loader.LoaderLogging;
|
import org.hibernate.loader.LoaderLogging;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||||
|
@ -109,15 +109,15 @@ public class LoaderHelper {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( entry.isExistsInDatabase() ) {
|
if ( entry.isExistsInDatabase() ) {
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent entityLockEvent = eventManager.beginEntityLockEvent();
|
final DiagnosticEvent entityLockEvent = eventMonitor.beginEntityLockEvent();
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
persister.lock( entry.getId(), entry.getVersion(), object, lockOptions, session );
|
persister.lock( entry.getId(), entry.getVersion(), object, lockOptions, session );
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeEntityLockEvent( entityLockEvent, entry.getId(),
|
eventMonitor.completeEntityLockEvent( entityLockEvent, entry.getId(),
|
||||||
persister.getEntityName(), lockOptions.getLockMode(), success, session );
|
persister.getEntityName(), lockOptions.getLockMode(), success, session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,12 @@ package org.hibernate.resource.jdbc.spi;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventManager;
|
||||||
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.resource.transaction.spi.TransactionCoordinator;
|
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}.
|
* Contract for something that controls a {@link JdbcSessionContext}.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -70,9 +74,31 @@ public interface JdbcSessionOwner {
|
||||||
*/
|
*/
|
||||||
Integer getJdbcBatchSize();
|
Integer getJdbcBatchSize();
|
||||||
|
|
||||||
EventManager getEventManager();
|
|
||||||
|
|
||||||
default SqlExceptionHelper getSqlExceptionHelper() {
|
default SqlExceptionHelper getSqlExceptionHelper() {
|
||||||
return getJdbcSessionContext().getJdbcServices().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) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ import java.util.function.Supplier;
|
||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.procedure.internal.ProcedureCallImpl;
|
import org.hibernate.procedure.internal.ProcedureCallImpl;
|
||||||
import org.hibernate.query.results.ResultSetMapping;
|
import org.hibernate.query.results.ResultSetMapping;
|
||||||
|
@ -68,8 +68,8 @@ public class OutputsImpl implements Outputs {
|
||||||
if ( sqlStatementLogger.getLogSlowQuery() > 0 ) {
|
if ( sqlStatementLogger.getLogSlowQuery() > 0 ) {
|
||||||
executeStartNanos = System.nanoTime();
|
executeStartNanos = System.nanoTime();
|
||||||
}
|
}
|
||||||
final EventManager eventManager = context.getSession().getEventManager();
|
final EventMonitor eventMonitor = context.getSession().getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent();
|
final DiagnosticEvent jdbcPreparedStatementExecutionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
final boolean isResultSet = jdbcStatement.execute();
|
final boolean isResultSet = jdbcStatement.execute();
|
||||||
currentReturnState = buildCurrentReturnState( isResultSet );
|
currentReturnState = buildCurrentReturnState( isResultSet );
|
||||||
|
@ -78,7 +78,7 @@ public class OutputsImpl implements Outputs {
|
||||||
throw convert( e, "Error calling CallableStatement.getMoreResults" );
|
throw convert( e, "Error calling CallableStatement.getMoreResults" );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, sql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, sql );
|
||||||
sqlStatementLogger.logSlowQuery( sql, executeStartNanos, this.context.getSession().getJdbcSessionContext() );
|
sqlStatementLogger.logSlowQuery( sql, executeStartNanos, this.context.getSession().getJdbcSessionContext() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.util.function.Function;
|
||||||
import org.hibernate.JDBCException;
|
import org.hibernate.JDBCException;
|
||||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.exception.ConstraintViolationException;
|
import org.hibernate.exception.ConstraintViolationException;
|
||||||
import org.hibernate.query.spi.QueryOptions;
|
import org.hibernate.query.spi.QueryOptions;
|
||||||
import org.hibernate.resource.jdbc.spi.LogicalConnectionImplementor;
|
import org.hibernate.resource.jdbc.spi.LogicalConnectionImplementor;
|
||||||
|
@ -82,15 +82,15 @@ public class StandardJdbcMutationExecutor implements JdbcMutationExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getEventListenerManager().jdbcExecuteStatementStart();
|
session.getEventListenerManager().jdbcExecuteStatementStart();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent();
|
final DiagnosticEvent jdbcPreparedStatementExecutionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
int rows = preparedStatement.executeUpdate();
|
int rows = preparedStatement.executeUpdate();
|
||||||
expectationCheck.accept( rows, preparedStatement );
|
expectationCheck.accept( rows, preparedStatement );
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql );
|
||||||
session.getEventListenerManager().jdbcExecuteStatementEnd();
|
session.getEventListenerManager().jdbcExecuteStatementEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.engine.spi.Status;
|
import org.hibernate.engine.spi.Status;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.event.spi.PreLoadEvent;
|
import org.hibernate.event.spi.PreLoadEvent;
|
||||||
import org.hibernate.event.spi.PreLoadEventListener;
|
import org.hibernate.event.spi.PreLoadEventListener;
|
||||||
import org.hibernate.internal.log.LoggingHelper;
|
import org.hibernate.internal.log.LoggingHelper;
|
||||||
|
@ -1506,10 +1506,10 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
|
||||||
// 2) Session#clear + some form of load
|
// 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
|
// 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() ) ) {
|
if ( persistenceContext.wasInsertedDuringTransaction( data.concreteDescriptor, data.entityKey.getIdentifier() ) ) {
|
||||||
boolean cacheContentChanged = false;
|
boolean cacheContentChanged = false;
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
// Updating the cache entry for entities that were inserted in this transaction
|
// Updating the cache entry for entities that were inserted in this transaction
|
||||||
// only makes sense for transactional caches. Other implementations no-op for #update
|
// only makes sense for transactional caches. Other implementations no-op for #update
|
||||||
|
@ -1530,20 +1530,20 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cacheAccess,
|
cacheAccess,
|
||||||
data.concreteDescriptor,
|
data.concreteDescriptor,
|
||||||
cacheContentChanged,
|
cacheContentChanged,
|
||||||
EventManager.CacheActionDescription.ENTITY_UPDATE
|
EventMonitor.CacheActionDescription.ENTITY_UPDATE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
||||||
boolean put = false;
|
boolean put = false;
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
try {
|
try {
|
||||||
eventListenerManager.cachePutStart();
|
eventListenerManager.cachePutStart();
|
||||||
put = cacheAccess.putFromLoad(
|
put = cacheAccess.putFromLoad(
|
||||||
|
@ -1556,13 +1556,13 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cacheAccess,
|
cacheAccess,
|
||||||
data.concreteDescriptor,
|
data.concreteDescriptor,
|
||||||
put,
|
put,
|
||||||
EventManager.CacheActionDescription.ENTITY_LOAD
|
EventMonitor.CacheActionDescription.ENTITY_LOAD
|
||||||
);
|
);
|
||||||
final StatisticsImplementor statistics = factory.getStatistics();
|
final StatisticsImplementor statistics = factory.getStatistics();
|
||||||
if ( put && statistics.isStatisticsEnabled() ) {
|
if ( put && statistics.isStatisticsEnabled() ) {
|
||||||
|
|
|
@ -16,8 +16,8 @@ import org.hibernate.engine.spi.PersistenceContext;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
|
||||||
|
@ -199,8 +199,8 @@ public class ResultsHelper {
|
||||||
// CollectionRegionAccessStrategy has no update, so avoid putting uncommitted data via putFromLoad
|
// CollectionRegionAccessStrategy has no update, so avoid putting uncommitted data via putFromLoad
|
||||||
if ( isPutFromLoad ) {
|
if ( isPutFromLoad ) {
|
||||||
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
final SessionEventListenerManager eventListenerManager = session.getEventListenerManager();
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent cachePutEvent = eventManager.beginCachePutEvent();
|
final DiagnosticEvent cachePutEvent = eventMonitor.beginCachePutEvent();
|
||||||
boolean put = false;
|
boolean put = false;
|
||||||
try {
|
try {
|
||||||
eventListenerManager.cachePutStart();
|
eventListenerManager.cachePutStart();
|
||||||
|
@ -214,13 +214,13 @@ public class ResultsHelper {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeCachePutEvent(
|
eventMonitor.completeCachePutEvent(
|
||||||
cachePutEvent,
|
cachePutEvent,
|
||||||
session,
|
session,
|
||||||
cacheAccess,
|
cacheAccess,
|
||||||
collectionDescriptor,
|
collectionDescriptor,
|
||||||
put,
|
put,
|
||||||
EventManager.CacheActionDescription.COLLECTION_INSERT
|
EventMonitor.CacheActionDescription.COLLECTION_INSERT
|
||||||
);
|
);
|
||||||
eventListenerManager.cachePutEnd();
|
eventListenerManager.cachePutEnd();
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
||||||
import org.hibernate.engine.spi.SessionEventListenerManager;
|
import org.hibernate.engine.spi.SessionEventListenerManager;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.CoreLogging;
|
import org.hibernate.internal.CoreLogging;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.query.spi.Limit;
|
import org.hibernate.query.spi.Limit;
|
||||||
|
@ -240,14 +240,14 @@ public class DeferredResultSetAccess extends AbstractResultSetAccess {
|
||||||
if ( sqlStatementLogger.getLogSlowQuery() > 0 ) {
|
if ( sqlStatementLogger.getLogSlowQuery() > 0 ) {
|
||||||
executeStartNanos = System.nanoTime();
|
executeStartNanos = System.nanoTime();
|
||||||
}
|
}
|
||||||
final EventManager eventManager = session.getEventManager();
|
final EventMonitor eventMonitor = session.getEventMonitor();
|
||||||
final HibernateMonitoringEvent jdbcPreparedStatementExecutionEvent = eventManager.beginJdbcPreparedStatementExecutionEvent();
|
final DiagnosticEvent jdbcPreparedStatementExecutionEvent = eventMonitor.beginJdbcPreparedStatementExecutionEvent();
|
||||||
try {
|
try {
|
||||||
eventListenerManager.jdbcExecuteStatementStart();
|
eventListenerManager.jdbcExecuteStatementStart();
|
||||||
resultSet = wrapResultSet( preparedStatement.executeQuery() );
|
resultSet = wrapResultSet( preparedStatement.executeQuery() );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
eventManager.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql );
|
eventMonitor.completeJdbcPreparedStatementExecutionEvent( jdbcPreparedStatementExecutionEvent, finalSql );
|
||||||
eventListenerManager.jdbcExecuteStatementEnd();
|
eventListenerManager.jdbcExecuteStatementEnd();
|
||||||
sqlStatementLogger.logSlowQuery( finalSql, executeStartNanos, context() );
|
sqlStatementLogger.logSlowQuery( finalSql, executeStartNanos, context() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description( "Cache Get Executed" )
|
@Description( "Cache Get Executed" )
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class CacheGetEvent extends Event implements HibernateMonitoringEvent {
|
public class CacheGetEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.CacheGet";
|
public static final String NAME = "org.hibernate.orm.CacheGet";
|
||||||
|
|
||||||
@Label( "Session Identifier" )
|
@Label( "Session Identifier" )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description( "Cache Put Executed" )
|
@Description( "Cache Put Executed" )
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class CachePutEvent extends Event implements HibernateMonitoringEvent {
|
public class CachePutEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.CachePut";
|
public static final String NAME = "org.hibernate.orm.CachePut";
|
||||||
|
|
||||||
@Label( "Session Identifier" )
|
@Label( "Session Identifier" )
|
||||||
|
|
|
@ -10,7 +10,7 @@ import jdk.jfr.Event;
|
||||||
import jdk.jfr.Label;
|
import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(CollectionRecreateEvent.NAME)
|
@Name(CollectionRecreateEvent.NAME)
|
||||||
|
@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Collection Recreate")
|
@Description("Collection Recreate")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class CollectionRecreateEvent extends Event implements HibernateMonitoringEvent {
|
public class CollectionRecreateEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.CollectionRecreateEvent";
|
public static final String NAME = "org.hibernate.orm.CollectionRecreateEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import jdk.jfr.Event;
|
||||||
import jdk.jfr.Label;
|
import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(CollectionRemoveEvent.NAME)
|
@Name(CollectionRemoveEvent.NAME)
|
||||||
|
@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Collection Remove")
|
@Description("Collection Remove")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class CollectionRemoveEvent extends Event implements HibernateMonitoringEvent {
|
public class CollectionRemoveEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.CollectionRemoveEvent";
|
public static final String NAME = "org.hibernate.orm.CollectionRemoveEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import jdk.jfr.Event;
|
||||||
import jdk.jfr.Label;
|
import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(CollectionUpdateEvent.NAME)
|
@Name(CollectionUpdateEvent.NAME)
|
||||||
|
@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Collection Update")
|
@Description("Collection Update")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class CollectionUpdateEvent extends Event implements HibernateMonitoringEvent {
|
public class CollectionUpdateEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.CollectionUpdateEvent";
|
public static final String NAME = "org.hibernate.orm.CollectionUpdateEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("DirtyCalculationEvent Execution")
|
@Description("DirtyCalculationEvent Execution")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class DirtyCalculationEvent extends Event implements HibernateMonitoringEvent {
|
public class DirtyCalculationEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.DirtyCalculationEvent";
|
public static final String NAME = "org.hibernate.orm.DirtyCalculationEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import jdk.jfr.Event;
|
||||||
import jdk.jfr.Label;
|
import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(EntityDeleteEvent.NAME)
|
@Name(EntityDeleteEvent.NAME)
|
||||||
|
@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Entity Delete")
|
@Description("Entity Delete")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class EntityDeleteEvent extends Event implements HibernateMonitoringEvent {
|
public class EntityDeleteEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.EntityDeleteEvent";
|
public static final String NAME = "org.hibernate.orm.EntityDeleteEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import jdk.jfr.Event;
|
||||||
import jdk.jfr.Label;
|
import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(EntityInsertEvent.NAME)
|
@Name(EntityInsertEvent.NAME)
|
||||||
|
@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Entity Insert")
|
@Description("Entity Insert")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class EntityInsertEvent extends Event implements HibernateMonitoringEvent {
|
public class EntityInsertEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.EntityInsertEvent";
|
public static final String NAME = "org.hibernate.orm.EntityInsertEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -11,7 +11,7 @@ import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(EntityLockEvent.NAME)
|
@Name(EntityLockEvent.NAME)
|
||||||
|
@ -20,7 +20,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Entity Delete")
|
@Description("Entity Delete")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class EntityLockEvent extends Event implements HibernateMonitoringEvent {
|
public class EntityLockEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.EntityDeleteEvent";
|
public static final String NAME = "org.hibernate.orm.EntityDeleteEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import jdk.jfr.Event;
|
||||||
import jdk.jfr.Label;
|
import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(EntityUpdateEvent.NAME)
|
@Name(EntityUpdateEvent.NAME)
|
||||||
|
@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Entity Update")
|
@Description("Entity Update")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class EntityUpdateEvent extends Event implements HibernateMonitoringEvent {
|
public class EntityUpdateEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.EntityUpdateEvent";
|
public static final String NAME = "org.hibernate.orm.EntityUpdateEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import jdk.jfr.Event;
|
||||||
import jdk.jfr.Label;
|
import jdk.jfr.Label;
|
||||||
import jdk.jfr.Name;
|
import jdk.jfr.Name;
|
||||||
import jdk.jfr.StackTrace;
|
import jdk.jfr.StackTrace;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
@Name(EntityUpsertEvent.NAME)
|
@Name(EntityUpsertEvent.NAME)
|
||||||
|
@ -19,7 +19,7 @@ import org.hibernate.internal.build.AllowNonPortable;
|
||||||
@Description("Entity Upsert")
|
@Description("Entity Upsert")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class EntityUpsertEvent extends Event implements HibernateMonitoringEvent {
|
public class EntityUpsertEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.EntityUpsertEvent";
|
public static final String NAME = "org.hibernate.orm.EntityUpsertEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("Flush Execution")
|
@Description("Flush Execution")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class FlushEvent extends Event implements HibernateMonitoringEvent {
|
public class FlushEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.FlushEvent";
|
public static final String NAME = "org.hibernate.orm.FlushEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("JDBC Batch Execution")
|
@Description("JDBC Batch Execution")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class JdbcBatchExecutionEvent extends Event implements HibernateMonitoringEvent {
|
public class JdbcBatchExecutionEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.JdbcBatchExecution";
|
public static final String NAME = "org.hibernate.orm.JdbcBatchExecution";
|
||||||
|
|
||||||
@Label("PreparedStatement SQL")
|
@Label("PreparedStatement SQL")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("JDBC Connection Obtained")
|
@Description("JDBC Connection Obtained")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class JdbcConnectionAcquisitionEvent extends Event implements HibernateMonitoringEvent {
|
public class JdbcConnectionAcquisitionEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.JdbcConnectionAcquisition";
|
public static final String NAME = "org.hibernate.orm.JdbcConnectionAcquisition";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("JDBC Connection Released")
|
@Description("JDBC Connection Released")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class JdbcConnectionReleaseEvent extends Event implements HibernateMonitoringEvent {
|
public class JdbcConnectionReleaseEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.JdbcConnectionRelease";
|
public static final String NAME = "org.hibernate.orm.JdbcConnectionRelease";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("JDBC PreparedStatement Created")
|
@Description("JDBC PreparedStatement Created")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class JdbcPreparedStatementCreationEvent extends Event implements HibernateMonitoringEvent {
|
public class JdbcPreparedStatementCreationEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.JdbcPreparedStatementCreation";
|
public static final String NAME = "org.hibernate.orm.JdbcPreparedStatementCreation";
|
||||||
|
|
||||||
@Label("PreparedStatement SQL")
|
@Label("PreparedStatement SQL")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description( "JDBC PreparedStatement Executed" )
|
@Description( "JDBC PreparedStatement Executed" )
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class JdbcPreparedStatementExecutionEvent extends Event implements HibernateMonitoringEvent {
|
public class JdbcPreparedStatementExecutionEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.JdbcPreparedStatementExecution";
|
public static final String NAME = "org.hibernate.orm.JdbcPreparedStatementExecution";
|
||||||
|
|
||||||
@Label( "PreparedStatement SQL" )
|
@Label( "PreparedStatement SQL" )
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.hibernate.cache.spi.access.CachedDomainDataAccess;
|
||||||
import org.hibernate.engine.spi.EntityEntry;
|
import org.hibernate.engine.spi.EntityEntry;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||||
import org.hibernate.event.spi.AutoFlushEvent;
|
import org.hibernate.event.spi.AutoFlushEvent;
|
||||||
import org.hibernate.event.spi.EventManager;
|
import org.hibernate.event.spi.EventMonitor;
|
||||||
import org.hibernate.event.spi.HibernateMonitoringEvent;
|
import org.hibernate.event.spi.DiagnosticEvent;
|
||||||
import org.hibernate.internal.build.AllowNonPortable;
|
import org.hibernate.internal.build.AllowNonPortable;
|
||||||
import org.hibernate.persister.collection.CollectionPersister;
|
import org.hibernate.persister.collection.CollectionPersister;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
|
@ -23,7 +23,7 @@ import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class JfrEventManager implements EventManager {
|
public class JfrEventMonitor implements EventMonitor {
|
||||||
|
|
||||||
private static final EventType sessionOpenEventType = EventType.getEventType( SessionOpenEvent.class );
|
private static final EventType sessionOpenEventType = EventType.getEventType( SessionOpenEvent.class );
|
||||||
private static final EventType sessionClosedEventType = EventType.getEventType( SessionClosedEvent.class );
|
private static final EventType sessionClosedEventType = EventType.getEventType( SessionClosedEvent.class );
|
||||||
|
@ -65,7 +65,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeSessionOpenEvent(
|
public void completeSessionOpenEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final SessionOpenEvent sessionOpenEvent = (SessionOpenEvent) monitoringEvent;
|
final SessionOpenEvent sessionOpenEvent = (SessionOpenEvent) monitoringEvent;
|
||||||
|
@ -91,7 +91,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeSessionClosedEvent(
|
public void completeSessionClosedEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final SessionClosedEvent sessionClosedEvent = (SessionClosedEvent) monitoringEvent;
|
final SessionClosedEvent sessionClosedEvent = (SessionClosedEvent) monitoringEvent;
|
||||||
|
@ -117,7 +117,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcConnectionAcquisitionEvent(
|
public void completeJdbcConnectionAcquisitionEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Object tenantId) {
|
Object tenantId) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
|
@ -147,7 +147,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcConnectionReleaseEvent(
|
public void completeJdbcConnectionReleaseEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Object tenantId) {
|
Object tenantId) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
|
@ -177,7 +177,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcPreparedStatementCreationEvent(
|
public void completeJdbcPreparedStatementCreationEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
String preparedStatementSql) {
|
String preparedStatementSql) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcPreparedStatementCreationEvent jdbcPreparedStatementCreation = (JdbcPreparedStatementCreationEvent) monitoringEvent;
|
final JdbcPreparedStatementCreationEvent jdbcPreparedStatementCreation = (JdbcPreparedStatementCreationEvent) monitoringEvent;
|
||||||
|
@ -203,7 +203,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcPreparedStatementExecutionEvent(
|
public void completeJdbcPreparedStatementExecutionEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
String preparedStatementSql) {
|
String preparedStatementSql) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcPreparedStatementExecutionEvent jdbcPreparedStatementExecutionEvent = (JdbcPreparedStatementExecutionEvent) monitoringEvent;
|
final JdbcPreparedStatementExecutionEvent jdbcPreparedStatementExecutionEvent = (JdbcPreparedStatementExecutionEvent) monitoringEvent;
|
||||||
|
@ -229,7 +229,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeJdbcBatchExecutionEvent(
|
public void completeJdbcBatchExecutionEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
String statementSql) {
|
String statementSql) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final JdbcBatchExecutionEvent jdbcBatchExecutionEvent = (JdbcBatchExecutionEvent) monitoringEvent;
|
final JdbcBatchExecutionEvent jdbcBatchExecutionEvent = (JdbcBatchExecutionEvent) monitoringEvent;
|
||||||
|
@ -242,7 +242,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginCachePutEvent() {
|
public DiagnosticEvent beginCachePutEvent() {
|
||||||
if ( cachePutEventType.isEnabled() ) {
|
if ( cachePutEventType.isEnabled() ) {
|
||||||
final CachePutEvent cachePutEvent = new CachePutEvent();
|
final CachePutEvent cachePutEvent = new CachePutEvent();
|
||||||
cachePutEvent.begin();
|
cachePutEvent.begin();
|
||||||
|
@ -255,7 +255,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
boolean cacheContentChanged,
|
boolean cacheContentChanged,
|
||||||
|
@ -275,7 +275,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -294,7 +294,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -318,7 +318,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCachePutEvent(
|
public void completeCachePutEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
CachedDomainDataAccess cachedDomainDataAccess,
|
CachedDomainDataAccess cachedDomainDataAccess,
|
||||||
CollectionPersister persister,
|
CollectionPersister persister,
|
||||||
|
@ -339,7 +339,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginCacheGetEvent() {
|
public DiagnosticEvent beginCacheGetEvent() {
|
||||||
if ( cacheGetEventType.isEnabled() ) {
|
if ( cacheGetEventType.isEnabled() ) {
|
||||||
final CacheGetEvent cacheGetEvent = new CacheGetEvent();
|
final CacheGetEvent cacheGetEvent = new CacheGetEvent();
|
||||||
cacheGetEvent.begin();
|
cacheGetEvent.begin();
|
||||||
|
@ -352,7 +352,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
boolean hit) {
|
boolean hit) {
|
||||||
|
@ -370,7 +370,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
|
@ -392,7 +392,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCacheGetEvent(
|
public void completeCacheGetEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
Region region,
|
Region region,
|
||||||
CollectionPersister persister,
|
CollectionPersister persister,
|
||||||
|
@ -424,14 +424,14 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeFlushEvent(
|
public void completeFlushEvent(
|
||||||
HibernateMonitoringEvent flushEvent,
|
DiagnosticEvent flushEvent,
|
||||||
org.hibernate.event.spi.FlushEvent event) {
|
org.hibernate.event.spi.FlushEvent event) {
|
||||||
completeFlushEvent( flushEvent, event, false );
|
completeFlushEvent( flushEvent, event, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeFlushEvent(
|
public void completeFlushEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
org.hibernate.event.spi.FlushEvent hibernateFlushEvent,
|
org.hibernate.event.spi.FlushEvent hibernateFlushEvent,
|
||||||
boolean autoFlush) {
|
boolean autoFlush) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
|
@ -461,7 +461,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completePartialFlushEvent(
|
public void completePartialFlushEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
AutoFlushEvent hibernateAutoFlushEvent) {
|
AutoFlushEvent hibernateAutoFlushEvent) {
|
||||||
if ( monitoringEvent != null) {
|
if ( monitoringEvent != null) {
|
||||||
final PartialFlushEvent jfrPartialFlushEvent = (PartialFlushEvent) monitoringEvent;
|
final PartialFlushEvent jfrPartialFlushEvent = (PartialFlushEvent) monitoringEvent;
|
||||||
|
@ -490,7 +490,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeDirtyCalculationEvent(
|
public void completeDirtyCalculationEvent(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session,
|
SharedSessionContractImplementor session,
|
||||||
EntityPersister persister,
|
EntityPersister persister,
|
||||||
EntityEntry entry,
|
EntityEntry entry,
|
||||||
|
@ -522,7 +522,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completePrePartialFlush(
|
public void completePrePartialFlush(
|
||||||
HibernateMonitoringEvent monitoringEvent,
|
DiagnosticEvent monitoringEvent,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
if ( monitoringEvent != null ) {
|
if ( monitoringEvent != null ) {
|
||||||
final PrePartialFlushEvent prePartialFlushEvent = (PrePartialFlushEvent) monitoringEvent;
|
final PrePartialFlushEvent prePartialFlushEvent = (PrePartialFlushEvent) monitoringEvent;
|
||||||
|
@ -535,7 +535,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityInsertEvent() {
|
public DiagnosticEvent beginEntityInsertEvent() {
|
||||||
if ( entityInsertEventType.isEnabled() ) {
|
if ( entityInsertEventType.isEnabled() ) {
|
||||||
final EntityInsertEvent event = new EntityInsertEvent();
|
final EntityInsertEvent event = new EntityInsertEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -548,7 +548,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeEntityInsertEvent(
|
public void completeEntityInsertEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String entityName,
|
Object id, String entityName,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -566,7 +566,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityUpdateEvent() {
|
public DiagnosticEvent beginEntityUpdateEvent() {
|
||||||
if ( entityUpdateEventType.isEnabled() ) {
|
if ( entityUpdateEventType.isEnabled() ) {
|
||||||
final EntityUpdateEvent event = new EntityUpdateEvent();
|
final EntityUpdateEvent event = new EntityUpdateEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -579,7 +579,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeEntityUpdateEvent(
|
public void completeEntityUpdateEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String entityName,
|
Object id, String entityName,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -597,7 +597,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityUpsertEvent() {
|
public DiagnosticEvent beginEntityUpsertEvent() {
|
||||||
if ( entityUpsertEventType.isEnabled() ) {
|
if ( entityUpsertEventType.isEnabled() ) {
|
||||||
final EntityUpsertEvent event = new EntityUpsertEvent();
|
final EntityUpsertEvent event = new EntityUpsertEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -610,7 +610,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeEntityUpsertEvent(
|
public void completeEntityUpsertEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String entityName,
|
Object id, String entityName,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -628,7 +628,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityDeleteEvent() {
|
public DiagnosticEvent beginEntityDeleteEvent() {
|
||||||
if ( entityDeleteEventType.isEnabled() ) {
|
if ( entityDeleteEventType.isEnabled() ) {
|
||||||
final EntityDeleteEvent event = new EntityDeleteEvent();
|
final EntityDeleteEvent event = new EntityDeleteEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -641,7 +641,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeEntityDeleteEvent(
|
public void completeEntityDeleteEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String entityName,
|
Object id, String entityName,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -659,7 +659,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginEntityLockEvent() {
|
public DiagnosticEvent beginEntityLockEvent() {
|
||||||
if ( entityLockEventType.isEnabled() ) {
|
if ( entityLockEventType.isEnabled() ) {
|
||||||
final EntityLockEvent event = new EntityLockEvent();
|
final EntityLockEvent event = new EntityLockEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -671,7 +671,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 ) {
|
if ( event != null ) {
|
||||||
final EntityLockEvent entityLockEvent = (EntityLockEvent) event;
|
final EntityLockEvent entityLockEvent = (EntityLockEvent) event;
|
||||||
entityLockEvent.end();
|
entityLockEvent.end();
|
||||||
|
@ -687,7 +687,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginCollectionRecreateEvent() {
|
public DiagnosticEvent beginCollectionRecreateEvent() {
|
||||||
if ( collectionRecreateEventType.isEnabled() ) {
|
if ( collectionRecreateEventType.isEnabled() ) {
|
||||||
final CollectionRecreateEvent event = new CollectionRecreateEvent();
|
final CollectionRecreateEvent event = new CollectionRecreateEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -700,7 +700,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCollectionRecreateEvent(
|
public void completeCollectionRecreateEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String role,
|
Object id, String role,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -718,7 +718,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginCollectionUpdateEvent() {
|
public DiagnosticEvent beginCollectionUpdateEvent() {
|
||||||
if ( collectionUpdateEventType.isEnabled() ) {
|
if ( collectionUpdateEventType.isEnabled() ) {
|
||||||
final CollectionUpdateEvent event = new CollectionUpdateEvent();
|
final CollectionUpdateEvent event = new CollectionUpdateEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -731,7 +731,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCollectionUpdateEvent(
|
public void completeCollectionUpdateEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String role,
|
Object id, String role,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -749,7 +749,7 @@ public class JfrEventManager implements EventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HibernateMonitoringEvent beginCollectionRemoveEvent() {
|
public DiagnosticEvent beginCollectionRemoveEvent() {
|
||||||
if ( collectionRemoveEventType.isEnabled() ) {
|
if ( collectionRemoveEventType.isEnabled() ) {
|
||||||
final CollectionRemoveEvent event = new CollectionRemoveEvent();
|
final CollectionRemoveEvent event = new CollectionRemoveEvent();
|
||||||
event.begin();
|
event.begin();
|
||||||
|
@ -762,7 +762,7 @@ public class JfrEventManager implements EventManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeCollectionRemoveEvent(
|
public void completeCollectionRemoveEvent(
|
||||||
HibernateMonitoringEvent event,
|
DiagnosticEvent event,
|
||||||
Object id, String role,
|
Object id, String role,
|
||||||
boolean success,
|
boolean success,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description( "PartialFlushEvent Execution" )
|
@Description( "PartialFlushEvent Execution" )
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class PartialFlushEvent extends Event implements HibernateMonitoringEvent {
|
public class PartialFlushEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.PartialFlushEvent";
|
public static final String NAME = "org.hibernate.orm.PartialFlushEvent";
|
||||||
|
|
||||||
@Label( "Session Identifier" )
|
@Label( "Session Identifier" )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -20,7 +20,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description( "PrePartialFlushEvent Execution" )
|
@Description( "PrePartialFlushEvent Execution" )
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class PrePartialFlushEvent extends Event implements HibernateMonitoringEvent {
|
public class PrePartialFlushEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.PrePartialFlushEvent";
|
public static final String NAME = "org.hibernate.orm.PrePartialFlushEvent";
|
||||||
|
|
||||||
@Label("Session Identifier")
|
@Label("Session Identifier")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -23,7 +23,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("Hibernate Session closed")
|
@Description("Hibernate Session closed")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class SessionClosedEvent extends Event implements HibernateMonitoringEvent {
|
public class SessionClosedEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.SessionClosed";
|
public static final String NAME = "org.hibernate.orm.SessionClosed";
|
||||||
|
|
||||||
@Label("Session Identifier" )
|
@Label("Session Identifier" )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.jfr.internal;
|
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 org.hibernate.internal.build.AllowNonPortable;
|
||||||
|
|
||||||
import jdk.jfr.Category;
|
import jdk.jfr.Category;
|
||||||
|
@ -23,7 +23,7 @@ import jdk.jfr.StackTrace;
|
||||||
@Description("Hibernate Session opened")
|
@Description("Hibernate Session opened")
|
||||||
@StackTrace
|
@StackTrace
|
||||||
@AllowNonPortable
|
@AllowNonPortable
|
||||||
public class SessionOpenEvent extends Event implements HibernateMonitoringEvent {
|
public class SessionOpenEvent extends Event implements DiagnosticEvent {
|
||||||
public static final String NAME = "org.hibernate.orm.SessionOpen";
|
public static final String NAME = "org.hibernate.orm.SessionOpen";
|
||||||
|
|
||||||
@Label("Session Identifier" )
|
@Label("Session Identifier" )
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
org.hibernate.event.jfr.internal.JfrEventManager
|
|
|
@ -0,0 +1 @@
|
||||||
|
org.hibernate.event.jfr.internal.JfrEventMonitor
|
|
@ -11,7 +11,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.event.jfr.internal.CachePutEvent;
|
import org.hibernate.event.jfr.internal.CachePutEvent;
|
||||||
import org.hibernate.event.jfr.internal.JdbcBatchExecutionEvent;
|
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.DomainModel;
|
||||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
|
@ -75,7 +75,7 @@ public class EntityInsertCachePutEventTests {
|
||||||
// cache strategy is READ_WRITE so no cache insert happened
|
// cache strategy is READ_WRITE so no cache insert happened
|
||||||
assertThat( event.getBoolean( "cacheChanged" ) ).isFalse();
|
assertThat( event.getBoolean( "cacheChanged" ) ).isFalse();
|
||||||
assertThat( event.getString( "regionName" ) ).isNotNull();
|
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();
|
jfrEvents.reset();
|
||||||
AnotherTestEntity anotherTestEntity = new AnotherTestEntity( 1, "name_1" );
|
AnotherTestEntity anotherTestEntity = new AnotherTestEntity( 1, "name_1" );
|
||||||
|
@ -103,7 +103,7 @@ public class EntityInsertCachePutEventTests {
|
||||||
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
||||||
assertThat( event.getString( "regionName" ) ).isNotNull();
|
assertThat( event.getString( "regionName" ) ).isNotNull();
|
||||||
assertThat( event.getBoolean( "isNaturalId" ) ).isFalse();
|
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() );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.event.jfr.internal.CachePutEvent;
|
import org.hibernate.event.jfr.internal.CachePutEvent;
|
||||||
import org.hibernate.event.jfr.internal.JdbcBatchExecutionEvent;
|
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.DomainModel;
|
||||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
|
@ -89,7 +89,7 @@ public class EntityUpdateCachePutEventTests {
|
||||||
assertThat( event.getBoolean( "cacheChanged" ) ).isFalse();
|
assertThat( event.getBoolean( "cacheChanged" ) ).isFalse();
|
||||||
assertThat( event.getBoolean( "isNaturalId" ) ).isFalse();
|
assertThat( event.getBoolean( "isNaturalId" ) ).isFalse();
|
||||||
assertThat( event.getString( "regionName" ) ).isNotNull();
|
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();
|
jfrEvents.reset();
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class EntityUpdateCachePutEventTests {
|
||||||
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
||||||
assertThat( event.getString( "regionName" ) ).isNotNull();
|
assertThat( event.getString( "regionName" ) ).isNotNull();
|
||||||
assertThat( event.getBoolean( "isNaturalId" ) ).isFalse();
|
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() );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.hibernate.annotations.NaturalId;
|
||||||
import org.hibernate.annotations.NaturalIdCache;
|
import org.hibernate.annotations.NaturalIdCache;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.event.jfr.internal.CachePutEvent;
|
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.DomainModel;
|
||||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
|
@ -72,7 +72,7 @@ public class NaturalIdPutCacheTests {
|
||||||
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
||||||
assertThat( event.getBoolean( "isNaturalId" ) ).isFalse();
|
assertThat( event.getBoolean( "isNaturalId" ) ).isFalse();
|
||||||
assertThat( event.getString( "regionName" ) ).isNotNull();
|
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 );
|
event = events.get( 1 );
|
||||||
assertThat( event.getEventType().getName() )
|
assertThat( event.getEventType().getName() )
|
||||||
|
@ -85,7 +85,7 @@ public class NaturalIdPutCacheTests {
|
||||||
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
||||||
assertThat( event.getBoolean( "isNaturalId" ) ).isTrue();
|
assertThat( event.getBoolean( "isNaturalId" ) ).isTrue();
|
||||||
assertThat( event.getString( "regionName" ) ).isNotNull();
|
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() );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.event.jfr.internal.CachePutEvent;
|
import org.hibernate.event.jfr.internal.CachePutEvent;
|
||||||
import org.hibernate.event.jfr.internal.JdbcBatchExecutionEvent;
|
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.DomainModel;
|
||||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
|
@ -85,7 +85,7 @@ public class QueryCachePutEventTests {
|
||||||
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
assertThat( event.getBoolean( "cacheChanged" ) ).isTrue();
|
||||||
assertThat( event.getString( "regionName" ) ).isNotNull();
|
assertThat( event.getString( "regionName" ) ).isNotNull();
|
||||||
assertThat( event.getBoolean( "isNaturalId" ) ).isFalse();
|
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() );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue