HHH-13462 Introduce a fastpath for SessionImpl#fireLoad to be used by internal loops
This commit is contained in:
parent
a49b7902cc
commit
a9d4c13d86
|
@ -1112,7 +1112,7 @@ public final class SessionImpl
|
|||
LoadEvent event = loadEvent;
|
||||
loadEvent = null;
|
||||
event = recycleEventInstance( event, id, entityName );
|
||||
fireLoad( event, LoadEventListener.IMMEDIATE_LOAD );
|
||||
fireLoadNoChecks( event, LoadEventListener.IMMEDIATE_LOAD );
|
||||
Object result = event.getResult();
|
||||
if ( loadEvent == null ) {
|
||||
event.setEntityClassName( null );
|
||||
|
@ -1153,7 +1153,7 @@ public final class SessionImpl
|
|||
loadEvent = null;
|
||||
event = recycleEventInstance( event, id, entityName );
|
||||
event.setShouldUnwrapProxy( unwrapProxy );
|
||||
fireLoad( event, type );
|
||||
fireLoadNoChecks( event, type );
|
||||
Object result = event.getResult();
|
||||
if ( !nullable ) {
|
||||
UnresolvableObjectException.throwIfNull( result, id, entityName );}
|
||||
|
@ -1269,11 +1269,20 @@ public final class SessionImpl
|
|||
|
||||
private void fireLoad(LoadEvent event, LoadType loadType) {
|
||||
checkOpenOrWaitingForAutoClose();
|
||||
checkTransactionSynchStatus();
|
||||
fireLoadNoChecks( event, loadType );
|
||||
delayedAfterCompletion();
|
||||
}
|
||||
|
||||
//Performance note:
|
||||
// This version of #fireLoad is meant to be invoked by internal methods only,
|
||||
// so to skip the session open, transaction synch, etc.. checks,
|
||||
// which have been proven to be not particularly cheap:
|
||||
// it seems they prevent these hot methods from being inlined.
|
||||
private void fireLoadNoChecks(LoadEvent event, LoadType loadType) {
|
||||
pulseTransactionCoordinator();
|
||||
for ( LoadEventListener listener : listeners( EventType.LOAD ) ) {
|
||||
listener.onLoad( event, loadType );
|
||||
}
|
||||
delayedAfterCompletion();
|
||||
}
|
||||
|
||||
private void fireResolveNaturalId(ResolveNaturalIdEvent event) {
|
||||
|
|
Loading…
Reference in New Issue