HHH-13447 Minimize number of EventListenerRegistry lookups within a Session use
This commit is contained in:
parent
e476a99250
commit
33f02f411f
|
@ -242,6 +242,7 @@ public final class SessionImpl
|
||||||
private transient boolean discardOnClose;
|
private transient boolean discardOnClose;
|
||||||
|
|
||||||
private transient TransactionObserver transactionObserver;
|
private transient TransactionObserver transactionObserver;
|
||||||
|
private transient EventListenerRegistry eventListenerRegistry;
|
||||||
|
|
||||||
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) {
|
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) {
|
||||||
super( factory, options );
|
super( factory, options );
|
||||||
|
@ -678,7 +679,10 @@ public final class SessionImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> EventListenerGroup<T> eventListenerGroup(EventType<T> type) {
|
private <T> EventListenerGroup<T> eventListenerGroup(EventType<T> type) {
|
||||||
return getFactory().getServiceRegistry().getService( EventListenerRegistry.class ).getEventListenerGroup( type );
|
if ( this.eventListenerRegistry == null ) {
|
||||||
|
this.eventListenerRegistry = getFactory().getServiceRegistry().getService( EventListenerRegistry.class );
|
||||||
|
}
|
||||||
|
return eventListenerRegistry.getEventListenerGroup( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue