HHH-13565 Move field AbstractSharedSessionContract#disallowOutOfTransactionUpdateOperations to constants in FastSessionServices
This commit is contained in:
parent
5eaa1498df
commit
a39acebde8
|
@ -139,7 +139,6 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
|||
|
||||
protected boolean closed;
|
||||
protected boolean waitingForAutoClose;
|
||||
private transient boolean disallowOutOfTransactionUpdateOperations;
|
||||
|
||||
// transient & non-final for Serialization purposes - ugh
|
||||
private transient SessionEventListenerManagerImpl sessionEventsManager = new SessionEventListenerManagerImpl();
|
||||
|
@ -157,7 +156,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
|||
this.factory = factory;
|
||||
this.fastSessionServices = factory.getFastSessionServices();
|
||||
this.cacheTransactionSync = factory.getCache().getRegionFactory().createTransactionContext( this );
|
||||
this.disallowOutOfTransactionUpdateOperations = !factory.getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations();
|
||||
|
||||
|
||||
this.flushMode = options.getInitialSessionFlushMode();
|
||||
|
||||
|
@ -407,7 +406,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
|||
|
||||
@Override
|
||||
public void checkTransactionNeededForUpdateOperation(String exceptionMessage) {
|
||||
if ( disallowOutOfTransactionUpdateOperations && !isTransactionInProgress() ) {
|
||||
if ( fastSessionServices.disallowOutOfTransactionUpdateOperations && !isTransactionInProgress() ) {
|
||||
throw new TransactionRequiredException( exceptionMessage );
|
||||
}
|
||||
}
|
||||
|
@ -1239,7 +1238,6 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
|||
.buildTransactionCoordinator( jdbcCoordinator, this );
|
||||
|
||||
entityNameResolver = new CoordinatingEntityNameResolver( factory, interceptor );
|
||||
this.disallowOutOfTransactionUpdateOperations = !getFactory().getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ import java.util.Objects;
|
|||
*/
|
||||
final class FastSessionServices {
|
||||
|
||||
// All session events need to be iterated frequently:
|
||||
|
||||
private final Iterable<ClearEventListener> clearEventListeners;
|
||||
private final Iterable<SaveOrUpdateEventListener> saveUpdateEventListeners;
|
||||
private final Iterable<EvictEventListener> evictEventListeners;
|
||||
|
@ -68,9 +70,14 @@ final class FastSessionServices {
|
|||
private final Iterable<InitializeCollectionEventListener> initCollectionEventListeners;
|
||||
private final Iterable<ResolveNaturalIdEventListener> resolveNaturalIdEventListeners;
|
||||
|
||||
//Intentionally Package private:
|
||||
final boolean disallowOutOfTransactionUpdateOperations;
|
||||
|
||||
FastSessionServices(SessionFactoryImpl sf) {
|
||||
Objects.requireNonNull( sf );
|
||||
final ServiceRegistryImplementor sr = sf.getServiceRegistry();
|
||||
|
||||
// Pre-compute all iterators on Event listeners:
|
||||
final EventListenerRegistry eventListenerRegistry = sr.getService( EventListenerRegistry.class );
|
||||
this.clearEventListeners = listeners( eventListenerRegistry, EventType.CLEAR );
|
||||
this.saveUpdateEventListeners = listeners( eventListenerRegistry, EventType.SAVE_UPDATE );
|
||||
|
@ -90,6 +97,9 @@ final class FastSessionServices {
|
|||
this.flushEventListeners = listeners( eventListenerRegistry, EventType.FLUSH );
|
||||
this.initCollectionEventListeners = listeners( eventListenerRegistry, EventType.INIT_COLLECTION );
|
||||
this.resolveNaturalIdEventListeners = listeners( eventListenerRegistry, EventType.RESOLVE_NATURAL_ID );
|
||||
|
||||
//Other highly useful constants:
|
||||
this.disallowOutOfTransactionUpdateOperations = !sf.getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations();
|
||||
}
|
||||
|
||||
Iterable<ClearEventListener> getClearEventListeners() {
|
||||
|
|
Loading…
Reference in New Issue