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 event = loadEvent;
|
||||||
loadEvent = null;
|
loadEvent = null;
|
||||||
event = recycleEventInstance( event, id, entityName );
|
event = recycleEventInstance( event, id, entityName );
|
||||||
fireLoad( event, LoadEventListener.IMMEDIATE_LOAD );
|
fireLoadNoChecks( event, LoadEventListener.IMMEDIATE_LOAD );
|
||||||
Object result = event.getResult();
|
Object result = event.getResult();
|
||||||
if ( loadEvent == null ) {
|
if ( loadEvent == null ) {
|
||||||
event.setEntityClassName( null );
|
event.setEntityClassName( null );
|
||||||
|
@ -1153,7 +1153,7 @@ public final class SessionImpl
|
||||||
loadEvent = null;
|
loadEvent = null;
|
||||||
event = recycleEventInstance( event, id, entityName );
|
event = recycleEventInstance( event, id, entityName );
|
||||||
event.setShouldUnwrapProxy( unwrapProxy );
|
event.setShouldUnwrapProxy( unwrapProxy );
|
||||||
fireLoad( event, type );
|
fireLoadNoChecks( event, type );
|
||||||
Object result = event.getResult();
|
Object result = event.getResult();
|
||||||
if ( !nullable ) {
|
if ( !nullable ) {
|
||||||
UnresolvableObjectException.throwIfNull( result, id, entityName );}
|
UnresolvableObjectException.throwIfNull( result, id, entityName );}
|
||||||
|
@ -1269,11 +1269,20 @@ public final class SessionImpl
|
||||||
|
|
||||||
private void fireLoad(LoadEvent event, LoadType loadType) {
|
private void fireLoad(LoadEvent event, LoadType loadType) {
|
||||||
checkOpenOrWaitingForAutoClose();
|
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 ) ) {
|
for ( LoadEventListener listener : listeners( EventType.LOAD ) ) {
|
||||||
listener.onLoad( event, loadType );
|
listener.onLoad( event, loadType );
|
||||||
}
|
}
|
||||||
delayedAfterCompletion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireResolveNaturalId(ResolveNaturalIdEvent event) {
|
private void fireResolveNaturalId(ResolveNaturalIdEvent event) {
|
||||||
|
|
Loading…
Reference in New Issue