diff --git a/hibernate-core/src/main/java/org/hibernate/EmptySessionEventsListener.java b/hibernate-core/src/main/java/org/hibernate/BaseSessionEventListener.java similarity index 91% rename from hibernate-core/src/main/java/org/hibernate/EmptySessionEventsListener.java rename to hibernate-core/src/main/java/org/hibernate/BaseSessionEventListener.java index 1ba1a51666..9ef723dc72 100644 --- a/hibernate-core/src/main/java/org/hibernate/EmptySessionEventsListener.java +++ b/hibernate-core/src/main/java/org/hibernate/BaseSessionEventListener.java @@ -24,13 +24,13 @@ package org.hibernate; /** - * A no-op implementation of SessionEventsListener. Intended as a convenient base class for developing - * SessionEventsListener implementations. + * A no-op implementation of SessionEventListener. Intended as a convenient base class for developing + * SessionEventListener implementations. * * @author Steve Ebersole */ @SuppressWarnings("UnusedDeclaration") -public class EmptySessionEventsListener implements SessionEventsListener { +public class BaseSessionEventListener implements SessionEventListener { @Override public void transactionCompletion(boolean successful) { } diff --git a/hibernate-core/src/main/java/org/hibernate/Session.java b/hibernate-core/src/main/java/org/hibernate/Session.java index 1832bbf45c..383cf855f4 100644 --- a/hibernate-core/src/main/java/org/hibernate/Session.java +++ b/hibernate-core/src/main/java/org/hibernate/Session.java @@ -1104,5 +1104,5 @@ public interface Session extends SharedSessionContract { * * @param listeners The listener(s) to add */ - public void addEventsListeners(SessionEventsListener... listeners); + public void addEventListeners(SessionEventListener... listeners); } diff --git a/hibernate-core/src/main/java/org/hibernate/SessionBuilder.java b/hibernate-core/src/main/java/org/hibernate/SessionBuilder.java index ea7b09fc07..7cb90fa0c6 100644 --- a/hibernate-core/src/main/java/org/hibernate/SessionBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/SessionBuilder.java @@ -119,13 +119,13 @@ public interface SessionBuilder { public SessionBuilder tenantIdentifier(String tenantIdentifier); /** - * Apply one or more SessionEventsListener instances to the listeners for the Session to be built. + * Apply one or more SessionEventListener instances to the listeners for the Session to be built. * * @param listeners The listeners to incorporate into the built Session * * @return {@code this}, for method chaining */ - public SessionBuilder eventListeners(SessionEventsListener... listeners); + public SessionBuilder eventListeners(SessionEventListener... listeners); /** * Remove all listeners intended for the built Session currently held here, including any auto-apply ones; in other diff --git a/hibernate-core/src/main/java/org/hibernate/SessionEventsListener.java b/hibernate-core/src/main/java/org/hibernate/SessionEventListener.java similarity index 97% rename from hibernate-core/src/main/java/org/hibernate/SessionEventsListener.java rename to hibernate-core/src/main/java/org/hibernate/SessionEventListener.java index ce18b70176..e8b298402f 100644 --- a/hibernate-core/src/main/java/org/hibernate/SessionEventsListener.java +++ b/hibernate-core/src/main/java/org/hibernate/SessionEventListener.java @@ -30,7 +30,7 @@ import java.io.Serializable; * * @author Steve Ebersole */ -public interface SessionEventsListener extends Serializable { +public interface SessionEventListener extends Serializable { public void transactionCompletion(boolean successful); public void jdbcConnectionAcquisitionStart(); diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java index 316ec56296..d84fb31c30 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityInsertAction.java @@ -152,11 +152,11 @@ public final class EntityInsertAction extends AbstractEntityInsertAction { private boolean cacheInsert(EntityPersister persister, CacheKey ck) { try { - getSession().getSessionEventsManager().cachePutStart(); + getSession().getEventListenerManager().cachePutStart(); return persister.getCacheAccessStrategy().insert( ck, cacheEntry, version ); } finally { - getSession().getSessionEventsManager().cachePutEnd(); + getSession().getEventListenerManager().cachePutEnd(); } } @@ -214,7 +214,7 @@ public final class EntityInsertAction extends AbstractEntityInsertAction { if ( success && isCachePutEnabled( persister, getSession() ) ) { final CacheKey ck = getSession().generateCacheKey( getId(), persister.getIdentifierType(), persister.getRootEntityName() ); try { - getSession().getSessionEventsManager().cachePutStart(); + getSession().getEventListenerManager().cachePutStart(); final boolean put = persister.getCacheAccessStrategy().afterInsert( ck, cacheEntry, version ); if ( put && getSession().getFactory().getStatistics().isStatisticsEnabled() ) { @@ -223,7 +223,7 @@ public final class EntityInsertAction extends AbstractEntityInsertAction { } } finally { - getSession().getSessionEventsManager().cachePutEnd(); + getSession().getEventListenerManager().cachePutEnd(); } } postCommitInsert(); diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java index c6abcb0f49..8cb9c8ef45 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityUpdateAction.java @@ -316,7 +316,7 @@ public final class EntityUpdateAction extends EntityAction { if ( success && cacheEntry!=null /*!persister.isCacheInvalidationRequired()*/ ) { try { - session.getSessionEventsManager().cachePutStart(); + session.getEventListenerManager().cachePutStart(); final boolean put = persister.getCacheAccessStrategy().afterUpdate( ck, cacheEntry, nextVersion, previousVersion, lock ); if ( put && getSession().getFactory().getStatistics().isStatisticsEnabled() ) { @@ -324,7 +324,7 @@ public final class EntityUpdateAction extends EntityAction { } } finally { - session.getSessionEventsManager().cachePutEnd(); + session.getEventListenerManager().cachePutEnd(); } } else { diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java index 792d472835..00891085ed 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java @@ -144,11 +144,11 @@ public class StandardQueryCache implements QueryCache { } try { - session.getSessionEventsManager().cachePutStart(); + session.getEventListenerManager().cachePutStart(); cacheRegion.put( key, cacheable ); } finally { - session.getSessionEventsManager().cachePutEnd(); + session.getEventListenerManager().cachePutEnd(); } return true; @@ -233,11 +233,11 @@ public class StandardQueryCache implements QueryCache { private List getCachedResults(QueryKey key, SessionImplementor session) { List cacheable = null; try { - session.getSessionEventsManager().cacheGetStart(); + session.getEventListenerManager().cacheGetStart(); cacheable = (List) cacheRegion.get( key ); } finally { - session.getSessionEventsManager().cacheGetEnd( cacheable != null ); + session.getEventListenerManager().cacheGetEnd( cacheable != null ); } return cacheable; } diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/UpdateTimestampsCache.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/UpdateTimestampsCache.java index 2a7f86d48e..446709f62c 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/UpdateTimestampsCache.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/UpdateTimestampsCache.java @@ -104,14 +104,14 @@ public class UpdateTimestampsCache { } try { - session.getSessionEventsManager().cachePutStart(); + session.getEventListenerManager().cachePutStart(); //put() has nowait semantics, is this really appropriate? //note that it needs to be async replication, never local or sync region.put( space, ts ); } finally { - session.getSessionEventsManager().cachePutEnd(); + session.getEventListenerManager().cachePutEnd(); } if ( stats ) { @@ -140,14 +140,14 @@ public class UpdateTimestampsCache { } try { - session.getSessionEventsManager().cachePutStart(); + session.getEventListenerManager().cachePutStart(); //put() has nowait semantics, is this really appropriate? //note that it needs to be async replication, never local or sync region.put( space, ts ); } finally { - session.getSessionEventsManager().cachePutEnd(); + session.getEventListenerManager().cachePutEnd(); } if ( stats ) { @@ -204,11 +204,11 @@ public class UpdateTimestampsCache { private Long getLastUpdateTimestampForSpace(Serializable space, SessionImplementor session) { Long ts = null; try { - session.getSessionEventsManager().cacheGetStart(); + session.getEventListenerManager().cacheGetStart(); ts = (Long) region.get( space ); } finally { - session.getSessionEventsManager().cacheGetEnd( ts != null ); + session.getEventListenerManager().cacheGetEnd( ts != null ); } return ts; } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index a673bf2876..15eb96882d 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -670,7 +670,7 @@ public interface AvailableSettings { String UNIQUE_CONSTRAINT_SCHEMA_UPDATE_STRATEGY = "hibernate.schema_update.unique_constraint_strategy"; /** - * A setting to control whether to {@link org.hibernate.engine.internal.LoggingSessionEventsListener} is + * A setting to control whether to {@link org.hibernate.engine.internal.StatisticalLoggingSessionEventListener} is * enabled on all Sessions (unless explicitly disabled for a given Session). The default value of this * setting is determined by the value for {@link #GENERATE_STATISTICS}, meaning that if collection of statistics * is enabled logging of Session metrics is enabled by default too. diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/BaselineSessionEventsListenerBuilder.java b/hibernate-core/src/main/java/org/hibernate/cfg/BaselineSessionEventsListenerBuilder.java index a666b76f80..d8a4d468f8 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/BaselineSessionEventsListenerBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/BaselineSessionEventsListenerBuilder.java @@ -27,19 +27,19 @@ import java.util.ArrayList; import java.util.List; import org.hibernate.HibernateException; -import org.hibernate.SessionEventsListener; -import org.hibernate.engine.internal.LoggingSessionEventsListener; +import org.hibernate.SessionEventListener; +import org.hibernate.engine.internal.StatisticalLoggingSessionEventListener; /** * @author Steve Ebersole */ public class BaselineSessionEventsListenerBuilder { private boolean logSessionMetrics; - private Class autoListener; + private Class autoListener; public BaselineSessionEventsListenerBuilder( boolean logSessionMetrics, - Class autoListener) { + Class autoListener) { this.logSessionMetrics = logSessionMetrics; this.autoListener = autoListener; } @@ -55,19 +55,19 @@ public class BaselineSessionEventsListenerBuilder { } @SuppressWarnings("UnusedDeclaration") - public Class getAutoListener() { + public Class getAutoListener() { return autoListener; } @SuppressWarnings("UnusedDeclaration") - public void setAutoListener(Class autoListener) { + public void setAutoListener(Class autoListener) { this.autoListener = autoListener; } - public List buildBaselineList() { - List list = new ArrayList(); - if ( logSessionMetrics && LoggingSessionEventsListener.isLoggingEnabled() ) { - list.add( new LoggingSessionEventsListener() ); + public List buildBaselineList() { + List list = new ArrayList(); + if ( logSessionMetrics && StatisticalLoggingSessionEventListener.isLoggingEnabled() ) { + list.add( new StatisticalLoggingSessionEventListener() ); } if ( autoListener != null ) { try { @@ -75,7 +75,7 @@ public class BaselineSessionEventsListenerBuilder { } catch (Exception e) { throw new HibernateException( - "Unable to instantiate specified auto SessionEventsListener : " + autoListener.getName(), + "Unable to instantiate specified auto SessionEventListener : " + autoListener.getName(), e ); } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java index 12d5480b0d..2ac3c2c956 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java @@ -34,14 +34,13 @@ import org.hibernate.EntityMode; import org.hibernate.HibernateException; import org.hibernate.MultiTenancyStrategy; import org.hibernate.NullPrecedence; -import org.hibernate.SessionEventsListener; +import org.hibernate.SessionEventListener; import org.hibernate.boot.registry.selector.spi.StrategySelector; import org.hibernate.cache.internal.NoCachingRegionFactory; import org.hibernate.cache.internal.RegionFactoryInitiator; import org.hibernate.cache.internal.StandardQueryCacheFactory; import org.hibernate.cache.spi.QueryCacheFactory; import org.hibernate.cache.spi.RegionFactory; -import org.hibernate.engine.internal.LoggingSessionEventsListener; import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.transaction.spi.TransactionFactory; @@ -416,9 +415,9 @@ public class SettingsFactory implements Serializable { settings.setJtaTrackByThread( jtaTrackByThread ); final String autoSessionEventsListenerName = properties.getProperty( AvailableSettings.AUTO_SESSION_EVENTS_LISTENER ); - final Class autoSessionEventsListener = autoSessionEventsListenerName == null + final Class autoSessionEventsListener = autoSessionEventsListenerName == null ? null - : strategySelector.selectStrategyImplementor( SessionEventsListener.class, autoSessionEventsListenerName ); + : strategySelector.selectStrategyImplementor( SessionEventListener.class, autoSessionEventsListenerName ); final boolean logSessionMetrics = ConfigurationHelper.getBoolean( AvailableSettings.LOG_SESSION_METRICS, diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/SessionEventsManagerImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/SessionEventListenerManagerImpl.java similarity index 73% rename from hibernate-core/src/main/java/org/hibernate/engine/internal/SessionEventsManagerImpl.java rename to hibernate-core/src/main/java/org/hibernate/engine/internal/SessionEventListenerManagerImpl.java index b6066f8536..5097891fa6 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/SessionEventsManagerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/SessionEventListenerManagerImpl.java @@ -27,18 +27,18 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import org.hibernate.SessionEventsListener; -import org.hibernate.engine.spi.SessionEventsManager; +import org.hibernate.SessionEventListener; +import org.hibernate.engine.spi.SessionEventListenerManager; /** * @author Steve Ebersole */ -public class SessionEventsManagerImpl implements SessionEventsManager, Serializable { - private List listenerList; +public class SessionEventListenerManagerImpl implements SessionEventListenerManager, Serializable { + private List listenerList; - public void addListener(SessionEventsListener... listeners) { + public void addListener(SessionEventListener... listeners) { if ( listenerList == null ) { - listenerList = new ArrayList(); + listenerList = new ArrayList(); } java.util.Collections.addAll( listenerList, listeners ); @@ -50,7 +50,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.transactionCompletion( successful ); } } @@ -61,7 +61,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionAcquisitionStart(); } } @@ -72,7 +72,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionAcquisitionEnd(); } } @@ -83,7 +83,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionReleaseStart(); } } @@ -94,7 +94,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionReleaseEnd(); } } @@ -105,7 +105,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcPrepareStatementStart(); } } @@ -116,7 +116,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcPrepareStatementEnd(); } } @@ -127,7 +127,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteStatementStart(); } } @@ -138,7 +138,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteStatementEnd(); } } @@ -149,7 +149,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteBatchStart(); } } @@ -160,7 +160,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteBatchEnd(); } } @@ -171,7 +171,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.cachePutStart(); } } @@ -182,7 +182,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.cachePutEnd(); } } @@ -193,7 +193,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.cacheGetStart(); } } @@ -204,7 +204,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.cacheGetEnd( hit ); } } @@ -215,7 +215,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.flushStart(); } } @@ -226,7 +226,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.flushEnd( numberOfEntities, numberOfCollections ); } } @@ -237,7 +237,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.partialFlushStart(); } } @@ -248,7 +248,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.partialFlushEnd( numberOfEntities, numberOfCollections ); } } @@ -259,7 +259,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.dirtyCalculationStart(); } } @@ -270,7 +270,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.dirtyCalculationEnd( dirty ); } } @@ -281,7 +281,7 @@ public class SessionEventsManagerImpl implements SessionEventsManager, Serializa return; } - for ( SessionEventsListener listener : listenerList ) { + for ( SessionEventListener listener : listenerList ) { listener.end(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/LoggingSessionEventsListener.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatisticalLoggingSessionEventListener.java similarity index 97% rename from hibernate-core/src/main/java/org/hibernate/engine/internal/LoggingSessionEventsListener.java rename to hibernate-core/src/main/java/org/hibernate/engine/internal/StatisticalLoggingSessionEventListener.java index 9d667cba61..300c3e7b5b 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/LoggingSessionEventsListener.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatisticalLoggingSessionEventListener.java @@ -25,13 +25,13 @@ package org.hibernate.engine.internal; import org.jboss.logging.Logger; -import org.hibernate.EmptySessionEventsListener; +import org.hibernate.BaseSessionEventListener; /** * @author Steve Ebersole */ -public class LoggingSessionEventsListener extends EmptySessionEventsListener { - private static final Logger log = Logger.getLogger( LoggingSessionEventsListener.class ); +public class StatisticalLoggingSessionEventListener extends BaseSessionEventListener { + private static final Logger log = Logger.getLogger( StatisticalLoggingSessionEventListener.class ); /** * Used by SettingsFactory (in conjunction with stats being enabled) to determine whether to apply this listener diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/TwoPhaseLoad.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/TwoPhaseLoad.java index cca0cf04b6..f70726b92c 100755 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/TwoPhaseLoad.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/TwoPhaseLoad.java @@ -217,7 +217,7 @@ public final class TwoPhaseLoad { } else { try { - session.getSessionEventsManager().cachePutStart(); + session.getEventListenerManager().cachePutStart(); final boolean put = persister.getCacheAccessStrategy().putFromLoad( cacheKey, persister.getCacheEntryStructure().structure( entry ), @@ -231,7 +231,7 @@ public final class TwoPhaseLoad { } } finally { - session.getSessionEventsManager().cachePutEnd(); + session.getEventListenerManager().cachePutEnd(); } } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/loading/internal/CollectionLoadContext.java b/hibernate-core/src/main/java/org/hibernate/engine/loading/internal/CollectionLoadContext.java index f7472162ce..9d15f6ca8c 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/loading/internal/CollectionLoadContext.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/loading/internal/CollectionLoadContext.java @@ -350,7 +350,7 @@ public class CollectionLoadContext { final CacheKey cacheKey = session.generateCacheKey( lce.getKey(), persister.getKeyType(), persister.getRole() ); try { - session.getSessionEventsManager().cachePutStart(); + session.getEventListenerManager().cachePutStart(); final boolean put = persister.getCacheAccessStrategy().putFromLoad( cacheKey, persister.getCacheEntryStructure().structure( entry ), @@ -364,7 +364,7 @@ public class CollectionLoadContext { } } finally { - session.getSessionEventsManager().cachePutEnd(); + session.getEventListenerManager().cachePutEnd(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java index 085a475d28..884ac8aa09 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java @@ -46,7 +46,7 @@ import org.hibernate.SQLQuery; import org.hibernate.ScrollMode; import org.hibernate.ScrollableResults; import org.hibernate.Session; -import org.hibernate.SessionEventsListener; +import org.hibernate.SessionEventListener; import org.hibernate.SessionFactory; import org.hibernate.SharedSessionBuilder; import org.hibernate.SimpleNaturalIdLoadAccess; @@ -390,8 +390,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor, Session { } @Override - public SessionEventsManager getSessionEventsManager() { - return sessionImplementor.getSessionEventsManager(); + public SessionEventListenerManager getEventListenerManager() { + return sessionImplementor.getEventListenerManager(); } // Delegates to Session @@ -807,7 +807,7 @@ public class SessionDelegatorBaseImpl implements SessionImplementor, Session { } @Override - public void addEventsListeners(SessionEventsListener... listeners) { - session.addEventsListeners( listeners ); + public void addEventListeners(SessionEventListener... listeners) { + session.addEventListeners( listeners ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionEventsManager.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionEventListenerManager.java similarity index 90% rename from hibernate-core/src/main/java/org/hibernate/engine/spi/SessionEventsManager.java rename to hibernate-core/src/main/java/org/hibernate/engine/spi/SessionEventListenerManager.java index 86eba47ca1..8f26665502 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionEventsManager.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionEventListenerManager.java @@ -23,10 +23,10 @@ */ package org.hibernate.engine.spi; -import org.hibernate.SessionEventsListener; +import org.hibernate.SessionEventListener; /** * @author Steve Ebersole */ -public interface SessionEventsManager extends SessionEventsListener { +public interface SessionEventListenerManager extends SessionEventListener { } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java index 74904531fa..f970384f77 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java @@ -408,5 +408,5 @@ public interface SessionImplementor extends Serializable, LobCreationContext { */ SQLQuery createSQLQuery(NamedSQLQueryDefinition namedQueryDefinition); - public SessionEventsManager getSessionEventsManager(); + public SessionEventListenerManager getEventListenerManager(); } diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultAutoFlushEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultAutoFlushEventListener.java index 913f6292dd..a290997809 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultAutoFlushEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultAutoFlushEventListener.java @@ -52,7 +52,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener public void onAutoFlush(AutoFlushEvent event) throws HibernateException { final EventSource source = event.getSession(); try { - source.getSessionEventsManager().partialFlushStart(); + source.getEventListenerManager().partialFlushStart(); if ( flushMightBeNeeded(source) ) { // Need to get the number of collection removals before flushing to executions @@ -82,7 +82,7 @@ public class DefaultAutoFlushEventListener extends AbstractFlushingEventListener } } finally { - source.getSessionEventsManager().partialFlushEnd( + source.getEventListenerManager().partialFlushEnd( event.getNumberOfEntitiesProcessed(), event.getNumberOfEntitiesProcessed() ); diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java index 56751c488f..f030d0390d 100755 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java @@ -527,7 +527,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener if ( dirtyProperties==null ) { // Interceptor returned null, so do the dirtycheck ourself, if possible try { - session.getSessionEventsManager().dirtyCalculationStart(); + session.getEventListenerManager().dirtyCalculationStart(); interceptorHandledDirtyCheck = false; // object loaded by update() @@ -567,7 +567,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener } } finally { - session.getSessionEventsManager().dirtyCalculationEnd( dirtyProperties != null ); + session.getEventListenerManager().dirtyCalculationEnd( dirtyProperties != null ); } } else { diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEventListener.java index 31bdbc21ee..54cbb6b8fc 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEventListener.java @@ -50,14 +50,14 @@ public class DefaultFlushEventListener extends AbstractFlushingEventListener imp persistenceContext.getCollectionEntries().size() > 0 ) { try { - source.getSessionEventsManager().flushStart(); + source.getEventListenerManager().flushStart(); flushEverythingToExecutions( event ); performExecutions( source ); postFlush( source ); } finally { - source.getSessionEventsManager().flushEnd( + source.getEventListenerManager().flushEnd( event.getNumberOfEntitiesProcessed(), event.getNumberOfCollectionsProcessed() ); diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java index 3f9d1eddc6..9d8fc37aba 100755 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultInitializeCollectionEventListener.java @@ -128,7 +128,7 @@ public class DefaultInitializeCollectionEventListener implements InitializeColle Object ce = null; try { - source.getSessionEventsManager().cacheGetStart(); + source.getEventListenerManager().cacheGetStart(); ce = persister.getCacheAccessStrategy().get(ck, source.getTimestamp()); if ( factory.getStatistics().isStatisticsEnabled() ) { @@ -143,7 +143,7 @@ public class DefaultInitializeCollectionEventListener implements InitializeColle } } finally { - source.getSessionEventsManager().cacheGetEnd( ce == null ); + source.getEventListenerManager().cacheGetEnd( ce == null ); } if ( ce == null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java index adea6d6036..aee858de9c 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java @@ -549,7 +549,7 @@ public class DefaultLoadEventListener extends AbstractLockUpgradeEventListener i Object ce = null; try { - source.getSessionEventsManager().cacheGetStart(); + source.getEventListenerManager().cacheGetStart(); ce = persister.getCacheAccessStrategy().get( ck, source.getTimestamp() ); if ( factory.getStatistics().isStatisticsEnabled() ) { @@ -566,7 +566,7 @@ public class DefaultLoadEventListener extends AbstractLockUpgradeEventListener i } } finally { - source.getSessionEventsManager().cacheGetEnd( ce == null ); + source.getEventListenerManager().cacheGetEnd( ce == null ); } if ( ce == null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java index 2b635baadd..1f6799003a 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java @@ -41,7 +41,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.internal.FormatStyle; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; -import org.hibernate.engine.spi.SessionEventsManager; +import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.id.enhanced.AccessCallback; import org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer; @@ -146,7 +146,7 @@ public class MultipleHiLoPerTableGenerator implements PersistentIdentifierGenera final SqlStatementLogger statementLogger = session.getFactory().getServiceRegistry() .getService( JdbcServices.class ) .getSqlStatementLogger(); - final SessionEventsManager statsCollector = session.getSessionEventsManager(); + final SessionEventListenerManager statsCollector = session.getEventListenerManager(); final WorkExecutorVisitable work = new AbstractReturningWork() { @Override @@ -235,7 +235,7 @@ public class MultipleHiLoPerTableGenerator implements PersistentIdentifierGenera Connection connection, String sql, SqlStatementLogger statementLogger, - SessionEventsManager statsCollector) throws SQLException { + SessionEventListenerManager statsCollector) throws SQLException { statementLogger.logStatement( sql, FormatStyle.BASIC.getFormatter() ); try { statsCollector.jdbcPrepareStatementStart(); @@ -246,7 +246,7 @@ public class MultipleHiLoPerTableGenerator implements PersistentIdentifierGenera } } - private int executeUpdate(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private int executeUpdate(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeUpdate(); @@ -257,7 +257,7 @@ public class MultipleHiLoPerTableGenerator implements PersistentIdentifierGenera } - private ResultSet executeQuery(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private ResultSet executeQuery(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeQuery(); diff --git a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java index 5a3960bf7d..b4abd52900 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java @@ -40,7 +40,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.internal.FormatStyle; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; -import org.hibernate.engine.spi.SessionEventsManager; +import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.id.enhanced.SequenceStyleGenerator; import org.hibernate.internal.CoreMessageLogger; @@ -148,7 +148,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab final SqlStatementLogger statementLogger = session.getFactory().getServiceRegistry() .getService( JdbcServices.class ) .getSqlStatementLogger(); - final SessionEventsManager statsCollector = session.getSessionEventsManager(); + final SessionEventListenerManager listeners = session.getEventListenerManager(); return session.getTransactionCoordinator().getTransaction().createIsolationDelegate().delegateWork( new AbstractReturningWork() { @@ -160,9 +160,9 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab // The loop ensures atomicity of the select + update even for no transaction or // read committed isolation level do { - final PreparedStatement qps = prepareStatement( connection, query, statementLogger, statsCollector ); + final PreparedStatement qps = prepareStatement( connection, query, statementLogger, listeners ); try { - ResultSet rs = executeQuery( qps, statsCollector ); + ResultSet rs = executeQuery( qps, listeners ); if ( !rs.next() ) { String err = "could not read a hi value - you need to populate the table: " + tableName; LOG.error(err); @@ -179,11 +179,11 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab qps.close(); } - final PreparedStatement ups = prepareStatement( connection, update, statementLogger, statsCollector ); + final PreparedStatement ups = prepareStatement( connection, update, statementLogger, listeners ); try { value.copy().increment().bind( ups, 1 ); value.bind( ups, 2 ); - rows = executeUpdate( ups, statsCollector ); + rows = executeUpdate( ups, listeners ); } catch (SQLException sqle) { LOG.error(LOG.unableToUpdateHiValue(tableName), sqle); @@ -205,7 +205,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab Connection connection, String sql, SqlStatementLogger statementLogger, - SessionEventsManager statsCollector) throws SQLException { + SessionEventListenerManager statsCollector) throws SQLException { statementLogger.logStatement( sql, FormatStyle.BASIC.getFormatter() ); try { statsCollector.jdbcPrepareStatementStart(); @@ -216,7 +216,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab } } - private int executeUpdate(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private int executeUpdate(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeUpdate(); @@ -227,7 +227,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab } - private ResultSet executeQuery(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private ResultSet executeQuery(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeQuery(); diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 20846de589..8f5b0b7fbe 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -45,7 +45,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.internal.FormatStyle; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; -import org.hibernate.engine.spi.SessionEventsManager; +import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.id.Configurable; import org.hibernate.id.IdentifierGeneratorHelper; @@ -529,7 +529,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab final SqlStatementLogger statementLogger = session.getFactory().getServiceRegistry() .getService( JdbcServices.class ) .getSqlStatementLogger(); - final SessionEventsManager statsCollector = session.getSessionEventsManager(); + final SessionEventListenerManager statsCollector = session.getEventListenerManager(); return optimizer.generate( new AccessCallback() { @@ -619,7 +619,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab Connection connection, String sql, SqlStatementLogger statementLogger, - SessionEventsManager statsCollector) throws SQLException { + SessionEventListenerManager statsCollector) throws SQLException { statementLogger.logStatement( sql, FormatStyle.BASIC.getFormatter() ); try { statsCollector.jdbcPrepareStatementStart(); @@ -630,7 +630,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab } } - private int executeUpdate(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private int executeUpdate(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeUpdate(); @@ -641,7 +641,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab } - private ResultSet executeQuery(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private ResultSet executeQuery(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeQuery(); diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java index 51a403992e..acab8b8709 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java @@ -37,7 +37,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.internal.FormatStyle; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.SqlStatementLogger; -import org.hibernate.engine.spi.SessionEventsManager; +import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.id.IdentifierGenerationException; import org.hibernate.id.IdentifierGeneratorHelper; @@ -123,7 +123,7 @@ public class TableStructure implements DatabaseStructure { final SqlStatementLogger statementLogger = session.getFactory().getServiceRegistry() .getService( JdbcServices.class ) .getSqlStatementLogger(); - final SessionEventsManager statsCollector = session.getSessionEventsManager(); + final SessionEventListenerManager statsCollector = session.getEventListenerManager(); return new AccessCallback() { @Override @@ -192,7 +192,7 @@ public class TableStructure implements DatabaseStructure { Connection connection, String sql, SqlStatementLogger statementLogger, - SessionEventsManager statsCollector) throws SQLException { + SessionEventListenerManager statsCollector) throws SQLException { statementLogger.logStatement( sql, FormatStyle.BASIC.getFormatter() ); try { statsCollector.jdbcPrepareStatementStart(); @@ -203,7 +203,7 @@ public class TableStructure implements DatabaseStructure { } } - private int executeUpdate(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private int executeUpdate(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeUpdate(); @@ -214,7 +214,7 @@ public class TableStructure implements DatabaseStructure { } - private ResultSet executeQuery(PreparedStatement ps, SessionEventsManager statsCollector) throws SQLException { + private ResultSet executeQuery(PreparedStatement ps, SessionEventListenerManager statsCollector) throws SQLException { try { statsCollector.jdbcExecuteStatementStart(); return ps.executeQuery(); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java index 263f0772fa..807744a73a 100755 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java @@ -35,10 +35,9 @@ import org.hibernate.MultiTenancyStrategy; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.ScrollableResults; -import org.hibernate.SessionEventsListener; +import org.hibernate.SessionEventListener; import org.hibernate.SessionException; import org.hibernate.SharedSessionContract; -import org.hibernate.engine.spi.SessionEventsManager; import org.hibernate.procedure.ProcedureCall; import org.hibernate.cache.spi.CacheKey; import org.hibernate.engine.jdbc.LobCreationContext; @@ -340,13 +339,13 @@ public abstract class AbstractSessionImpl if ( jdbcConnectionAccess == null ) { if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) { jdbcConnectionAccess = new NonContextualJdbcConnectionAccess( - getSessionEventsManager(), + getEventListenerManager(), factory.getServiceRegistry().getService( ConnectionProvider.class ) ); } else { jdbcConnectionAccess = new ContextualJdbcConnectionAccess( - getSessionEventsManager(), + getEventListenerManager(), factory.getServiceRegistry().getService( MultiTenantConnectionProvider.class ) ); } @@ -364,11 +363,11 @@ public abstract class AbstractSessionImpl } private static class NonContextualJdbcConnectionAccess implements JdbcConnectionAccess, Serializable { - private final SessionEventsListener listener; + private final SessionEventListener listener; private final ConnectionProvider connectionProvider; private NonContextualJdbcConnectionAccess( - SessionEventsListener listener, + SessionEventListener listener, ConnectionProvider connectionProvider) { this.listener = listener; this.connectionProvider = connectionProvider; @@ -403,11 +402,11 @@ public abstract class AbstractSessionImpl } private class ContextualJdbcConnectionAccess implements JdbcConnectionAccess, Serializable { - private final SessionEventsListener listener; + private final SessionEventListener listener; private final MultiTenantConnectionProvider connectionProvider; private ContextualJdbcConnectionAccess( - SessionEventsListener listener, + SessionEventListener listener, MultiTenantConnectionProvider connectionProvider) { this.listener = listener; this.connectionProvider = connectionProvider; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 8591a8ee1a..74e69b208a 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -57,7 +57,7 @@ import org.hibernate.MultiTenancyStrategy; import org.hibernate.ObjectNotFoundException; import org.hibernate.Session; import org.hibernate.SessionBuilder; -import org.hibernate.SessionEventsListener; +import org.hibernate.SessionEventListener; import org.hibernate.SessionFactory; import org.hibernate.SessionFactoryObserver; import org.hibernate.StatelessSession; @@ -1553,7 +1553,7 @@ public final class SessionFactoryImpl private boolean autoJoinTransactions = true; private boolean flushBeforeCompletion; private String tenantIdentifier; - private List listeners; + private List listeners; SessionBuilderImpl(SessionFactoryImpl sessionFactory) { this.sessionFactory = sessionFactory; @@ -1594,8 +1594,8 @@ public final class SessionFactoryImpl tenantIdentifier ); - for ( SessionEventsListener listener : listeners ) { - session.getSessionEventsManager().addListener( listener ); + for ( SessionEventListener listener : listeners ) { + session.getEventListenerManager().addListener( listener ); } return session; @@ -1656,7 +1656,7 @@ public final class SessionFactoryImpl } @Override - public SessionBuilder eventListeners(SessionEventsListener... listeners) { + public SessionBuilder eventListeners(SessionEventListener... listeners) { Collections.addAll( this.listeners, listeners ); return this; } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index b0a17d169a..422579486f 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -73,7 +73,7 @@ import org.hibernate.ScrollMode; import org.hibernate.ScrollableResults; import org.hibernate.Session; import org.hibernate.SessionBuilder; -import org.hibernate.SessionEventsListener; +import org.hibernate.SessionEventListener; import org.hibernate.SessionException; import org.hibernate.SharedSessionBuilder; import org.hibernate.SimpleNaturalIdLoadAccess; @@ -84,7 +84,7 @@ import org.hibernate.UnknownProfileException; import org.hibernate.UnresolvableObjectException; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.criterion.NaturalIdentifier; -import org.hibernate.engine.internal.SessionEventsManagerImpl; +import org.hibernate.engine.internal.SessionEventListenerManagerImpl; import org.hibernate.engine.internal.StatefulPersistenceContext; import org.hibernate.engine.jdbc.LobCreator; import org.hibernate.engine.jdbc.NonContextualLobCreator; @@ -213,6 +213,8 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc private final transient boolean isTransactionCoordinatorShared; private transient TransactionObserver transactionObserver; + private SessionEventListenerManagerImpl sessionEventsManager = new SessionEventListenerManagerImpl(); + /** * Constructor used for openSession(...) processing, as well as construction * of sessions for getCurrentSession(). @@ -357,7 +359,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc if ( factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().closeSession(); } - getSessionEventsManager().end(); + getEventListenerManager().end(); try { if ( !isTransactionCoordinatorShared ) { @@ -635,7 +637,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc persistenceContext.afterTransactionCompletion(); actionQueue.afterTransactionCompletion( successful ); - getSessionEventsManager().transactionCompletion( successful ); + getEventListenerManager().transactionCompletion( successful ); try { interceptor.afterTransactionCompletion( hibernateTransaction ); @@ -659,50 +661,44 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc return sql; } - private SessionEventsManagerImpl sessionEventsManager; - @Override - public SessionEventsManagerImpl getSessionEventsManager() { - if ( sessionEventsManager == null ) { - sessionEventsManager = new SessionEventsManagerImpl(); - } - + public SessionEventListenerManagerImpl getEventListenerManager() { return sessionEventsManager; } @Override - public void addEventsListeners(SessionEventsListener... listeners) { - getSessionEventsManager().addListener( listeners ); + public void addEventListeners(SessionEventListener... listeners) { + getEventListenerManager().addListener( listeners ); } @Override public void startPrepareStatement() { - getSessionEventsManager().jdbcPrepareStatementStart(); + getEventListenerManager().jdbcPrepareStatementStart(); } @Override public void endPrepareStatement() { - getSessionEventsManager().jdbcPrepareStatementEnd(); + getEventListenerManager().jdbcPrepareStatementEnd(); } @Override public void startStatementExecution() { - getSessionEventsManager().jdbcExecuteStatementStart(); + getEventListenerManager().jdbcExecuteStatementStart(); } @Override public void endStatementExecution() { - getSessionEventsManager().jdbcExecuteStatementEnd(); + getEventListenerManager().jdbcExecuteStatementEnd(); } @Override public void startBatchExecution() { - getSessionEventsManager().jdbcExecuteBatchStart(); + getEventListenerManager().jdbcExecuteBatchStart(); } @Override public void endBatchExecution() { - getSessionEventsManager().jdbcExecuteBatchEnd(); + getEventListenerManager().jdbcExecuteBatchEnd(); } /** @@ -2442,7 +2438,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc } @Override - public SharedSessionBuilder eventListeners(SessionEventsListener... listeners) { + public SharedSessionBuilder eventListeners(SessionEventListener... listeners) { super.eventListeners( listeners ); return this; } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java index 250ac364f2..602ca75301 100755 --- a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java @@ -48,7 +48,7 @@ import org.hibernate.Transaction; import org.hibernate.UnresolvableObjectException; import org.hibernate.cache.spi.CacheKey; import org.hibernate.collection.spi.PersistentCollection; -import org.hibernate.engine.internal.SessionEventsManagerImpl; +import org.hibernate.engine.internal.SessionEventListenerManagerImpl; import org.hibernate.engine.internal.StatefulPersistenceContext; import org.hibernate.engine.internal.Versioning; import org.hibernate.engine.query.spi.HQLQueryPlan; @@ -59,7 +59,7 @@ import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.NonFlushedChanges; import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.QueryParameters; -import org.hibernate.engine.spi.SessionEventsManager; +import org.hibernate.engine.spi.SessionEventListenerManager; import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.spi.TransactionCoordinator; import org.hibernate.engine.transaction.spi.TransactionEnvironment; @@ -395,12 +395,12 @@ public class StatelessSessionImpl extends AbstractSessionImpl implements Statele return sql; } - private SessionEventsManagerImpl sessionEventsManager; + private SessionEventListenerManagerImpl sessionEventsManager; @Override - public SessionEventsManager getSessionEventsManager() { + public SessionEventListenerManager getEventListenerManager() { if ( sessionEventsManager == null ) { - sessionEventsManager = new SessionEventsManagerImpl(); + sessionEventsManager = new SessionEventListenerManagerImpl(); } return sessionEventsManager; } diff --git a/hibernate-core/src/test/resources/log4j.properties b/hibernate-core/src/test/resources/log4j.properties index 22a8a7ce36..d406433daa 100644 --- a/hibernate-core/src/test/resources/log4j.properties +++ b/hibernate-core/src/test/resources/log4j.properties @@ -56,4 +56,4 @@ log4j.logger.org.hibernate.loader.plan2.build.internal.LoadPlanImpl=debug log4j.logger.org.hibernate.loader.plan2.build.spi.LoadPlanTreePrinter=debug log4j.logger.org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails=debug -log4j.logger.org.hibernate.engine.internal.LoggingSessionEventsListener=info \ No newline at end of file +log4j.logger.org.hibernate.engine.internal.StatisticalLoggingSessionEventListener=info \ No newline at end of file