@@ -89,20 +89,15 @@ class StatefulPersistenceContext implements PersistenceContext {
8989
9090private static final int INIT_COLL_SIZE = 8 ;
9191
92- /*
93- Eagerly Initialized Fields
94- the following fields are used in all circumstances, and are not worth (or not suited) to being converted into lazy
95- */
92+ // Eagerly initialized fields. The following fields are used in every circumstance
93+ // and are not worth (or not suited) to being converted to lazy initialization.
94+
9695private final SharedSessionContractImplementor session ;
9796private EntityEntryContext entityEntryContext ;
9897
99- /*
100- Everything else below should be carefully initialized only on first need;
101- this optimisation is very effective as null checks are free, while allocation costs
102- are very often the dominating cost of an application using ORM.
103- This is not general advice, but it's worth the added maintenance burden in this case
104- as this is a very central component of our library.
105- */
98+ // Everything else below should be carefully initialized only on first need.
99+ // This optimization is very effective as null checks are free, while allocation
100+ // costs are very often the dominating cost of an application using ORM.
106101
107102// Loaded entity instances, by EntityKey
108103private HashMap <EntityKey , EntityHolderImpl > entitiesByKey ;
@@ -113,8 +108,7 @@ the following fields are used in all circumstances, and are not worth (or not su
113108// Loaded entity instances, by EntityUniqueKey
114109private HashMap <EntityUniqueKey , Object > entitiesByUniqueKey ;
115110
116-
117- // Snapshots of current database state for entities
111+ // Snapshots of the current database state for entities
118112// that have *not* been loaded
119113private HashMap <EntityKey , Object > entitySnapshotsByKey ;
120114
@@ -136,7 +130,7 @@ the following fields are used in all circumstances, and are not worth (or not su
136130// Set of EntityKeys of deleted unloaded proxies
137131private HashSet <EntityKey > deletedUnloadedEntityKeys ;
138132
139- // properties that we have tried to load, and not found in the database
133+ // properties that we have tried to load and not found in the database
140134private HashSet <AssociationKey > nullAssociations ;
141135
142136// A list of collection wrappers that were instantiating during result set
@@ -209,14 +203,6 @@ public boolean hasLoadContext() {
209203return loadContexts != null ;
210204}
211205
212- // @Override
213- // public void addUnownedCollection(CollectionKey key, PersistentCollection collection) {
214- // if ( unownedCollections == null ) {
215- // unownedCollections = CollectionHelper.mapOfSize( INIT_COLL_SIZE );
216- // }
217- // unownedCollections.put( key, collection );
218- // }
219- //
220206@ Override
221207public PersistentCollection <?> useUnownedCollection (CollectionKey key ) {
222208return unownedCollections == null ? null : unownedCollections .remove ( key );
@@ -935,7 +921,7 @@ else if ( ownerPersister.isInstance( key ) ) {
935921}
936922else {
937923// b) try by EntityKey, which means we need to resolve owner-key -> collection-key
938- // IMPL NOTE : yes if we get here this impl is very non-performant, but PersistenceContext
924+ // IMPL NOTE: yes if we get here this impl is very non-performant, but PersistenceContext
939925// was never designed to handle this case; adding that capability for real means splitting
940926// the notions of:
941927// 1) collection key
@@ -1228,14 +1214,6 @@ public Object removeProxy(EntityKey key) {
12281214return removeProxyByKey ( key );
12291215}
12301216
1231- // @Override
1232- // public HashSet getNullifiableEntityKeys() {
1233- // if ( nullifiableEntityKeys == null ) {
1234- // nullifiableEntityKeys = new HashSet<>();
1235- // }
1236- // return nullifiableEntityKeys;
1237- // }
1238-
12391217/**
12401218 * @deprecated this will be removed: it provides too wide access, making it hard to optimise the internals
12411219 * for specific access needs. Consider using #iterateEntities instead.
0 commit comments