Skip to content

Commit 3981916

Browse files
committed
HHH-19348 Change scope of private methods in SessionImpl
Change scopes of some private methods to avoid duplication in Hibernate Reactive. Related to hibernate/hibernate-reactive#2181
1 parent 1e7fecb commit 3981916

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java

+14-7
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,8 @@ public Object loadFromSecondLevelCache(
11021102
* Helper to avoid creating many new instances of {@link PostLoadEvent}.
11031103
* It's an allocation hot spot.
11041104
*/
1105-
private PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Object entity) {
1105+
// Hibernate Reactive may need to use this
1106+
protected PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Object entity) {
11061107
final PostLoadEvent event = postLoadEvent;
11071108
if ( event == null ) {
11081109
return new PostLoadEvent( id, persister, entity, this );
@@ -1120,7 +1121,8 @@ private PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Ob
11201121
* Helper to avoid creating many new instances of {@link LoadEvent}.
11211122
* It's an allocation hot spot.
11221123
*/
1123-
private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, LockOptions lockOptions) {
1124+
// Hibernate Reactive may need to use this
1125+
protected LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, LockOptions lockOptions) {
11241126
final LoadEvent event = loadEvent;
11251127
if ( event == null ) {
11261128
return new LoadEvent( id, entityName, lockOptions, this, readOnly );
@@ -1141,7 +1143,8 @@ private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly,
11411143
* Helper to avoid creating many new instances of {@link LoadEvent}.
11421144
* It's an allocation hot spot.
11431145
*/
1144-
private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, boolean isAssociationFetch) {
1146+
// Hibernate Reactive may need to use this
1147+
protected LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, boolean isAssociationFetch) {
11451148
final LoadEvent event = loadEvent;
11461149
if ( event == null ) {
11471150
return new LoadEvent( id, entityName, isAssociationFetch, this, readOnly );
@@ -1158,7 +1161,8 @@ private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly,
11581161
}
11591162
}
11601163

1161-
private void releasePostLoadEvent(PostLoadEvent event) {
1164+
// Hibernate Reactive may need to use this
1165+
protected void releasePostLoadEvent(PostLoadEvent event) {
11621166
if ( postLoadEvent == null ) {
11631167
event.setEntity( null );
11641168
event.setId( null );
@@ -1167,7 +1171,8 @@ private void releasePostLoadEvent(PostLoadEvent event) {
11671171
}
11681172
}
11691173

1170-
private void releaseLoadEvent(LoadEvent event) {
1174+
// Hibernate Reactive may need to use this
1175+
protected void releaseLoadEvent(LoadEvent event) {
11711176
if ( loadEvent == null ) {
11721177
event.setEntityClassName( null );
11731178
event.setEntityId( null );
@@ -2568,7 +2573,8 @@ private void checkTransactionNeededForLock(LockMode lockMode) {
25682573
}
25692574
}
25702575

2571-
private static Boolean readOnlyHint(Map<String, Object> properties) {
2576+
// Hibernate Reactive may need to use this
2577+
protected static Boolean readOnlyHint(Map<String, Object> properties) {
25722578
if ( properties == null ) {
25732579
return null;
25742580
}
@@ -3056,7 +3062,8 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
30563062
eventListenerGroups = getFactory().getEventListenerGroups();
30573063
}
30583064

3059-
private Boolean getReadOnlyFromLoadQueryInfluencers() {
3065+
// Used by Hibernate reactive
3066+
protected Boolean getReadOnlyFromLoadQueryInfluencers() {
30603067
return loadQueryInfluencers != null ? loadQueryInfluencers.getReadOnly() : null;
30613068
}
30623069
}

0 commit comments

Comments
 (0)