mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 08:35:13 +00:00
HHH-6862 Switch to use Iterable from Iterator in IdentityMap helpers
This commit is contained in:
parent
aa4954be8b
commit
ad3afa4b7d
@ -1162,9 +1162,7 @@ && isFoundInParent( propertyName, childEntity, persister, collectionPersister, p
|
||||
|
||||
//not found in case, proceed
|
||||
// iterate all the entities currently associated with the persistence context.
|
||||
Iterator<Entry<Object,EntityEntry>> entities = IdentityMap.entriesIterator( entityEntries );
|
||||
while ( entities.hasNext() ) {
|
||||
final Map.Entry<Object,EntityEntry> me = entities.next();
|
||||
for ( Entry<Object,EntityEntry> me : IdentityMap.entriesIterable( entityEntries ) ) {
|
||||
final EntityEntry entityEntry = me.getValue();
|
||||
// does this entity entry pertain to the entity persister in which we are interested (owner)?
|
||||
if ( persister.isSubclassEntityName( entityEntry.getEntityName() ) ) {
|
||||
@ -1286,9 +1284,7 @@ public Object getIndexInOwner(String entity, String property, Object childEntity
|
||||
}
|
||||
|
||||
//Not found in cache, proceed
|
||||
Iterator<Entry<Object,EntityEntry>> entities = IdentityMap.entriesIterator( entityEntries );
|
||||
while ( entities.hasNext() ) {
|
||||
Map.Entry<Object,EntityEntry> me = entities.next();
|
||||
for ( Entry<Object, EntityEntry> me : IdentityMap.entriesIterable( entityEntries ) ) {
|
||||
EntityEntry ee = me.getValue();
|
||||
if ( persister.isSubclassEntityName( ee.getEntityName() ) ) {
|
||||
Object instance = me.getKey();
|
||||
|
@ -186,10 +186,9 @@ private void prepareCollectionFlushes(PersistenceContext persistenceContext) thr
|
||||
|
||||
LOG.debug( "Dirty checking collections" );
|
||||
|
||||
Iterator<Map.Entry<PersistentCollection,CollectionEntry>> entriesIterator = IdentityMap.entriesIterator( persistenceContext.getCollectionEntries() );
|
||||
while ( entriesIterator.hasNext() ) {
|
||||
Map.Entry<PersistentCollection,CollectionEntry> e = entriesIterator.next();
|
||||
e.getValue().preFlush( e.getKey() );
|
||||
for ( Map.Entry<PersistentCollection,CollectionEntry> entry :
|
||||
IdentityMap.entriesIterable( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
entry.getValue().preFlush( entry.getKey() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,9 +245,8 @@ private void flushCollections(final EventSource session, final PersistenceContex
|
||||
|
||||
LOG.trace( "Processing unreferenced collections" );
|
||||
|
||||
Iterator<Map.Entry<PersistentCollection,CollectionEntry>> entriesIterator = IdentityMap.entriesIterator( persistenceContext.getCollectionEntries() );
|
||||
while ( entriesIterator.hasNext() ) {
|
||||
Map.Entry<PersistentCollection,CollectionEntry> me = entriesIterator.next();
|
||||
for ( Map.Entry<PersistentCollection,CollectionEntry> me :
|
||||
IdentityMap.entriesIterable( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
CollectionEntry ce = me.getValue();
|
||||
if ( !ce.isReached() && !ce.isIgnore() ) {
|
||||
Collections.processUnreachableCollection( me.getKey(), session );
|
||||
@ -259,10 +257,9 @@ private void flushCollections(final EventSource session, final PersistenceContex
|
||||
|
||||
LOG.trace( "Scheduling collection removes/(re)creates/updates" );
|
||||
|
||||
entriesIterator = IdentityMap.entriesIterator( persistenceContext.getCollectionEntries() );
|
||||
ActionQueue actionQueue = session.getActionQueue();
|
||||
while ( entriesIterator.hasNext() ) {
|
||||
Map.Entry<PersistentCollection,CollectionEntry> me = entriesIterator.next();
|
||||
for ( Map.Entry<PersistentCollection,CollectionEntry> me :
|
||||
IdentityMap.entriesIterable( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
PersistentCollection coll = me.getKey();
|
||||
CollectionEntry ce = me.getValue();
|
||||
|
||||
|
@ -90,8 +90,8 @@ public static <K,V> Map.Entry<K,V>[] concurrentEntries(Map<K,V> map) {
|
||||
return ( (IdentityMap<K,V>) map ).entryArray();
|
||||
}
|
||||
|
||||
public static <K,V> Iterator<Map.Entry<K,V>> entriesIterator(Map<K,V> map) {
|
||||
return ( (IdentityMap<K,V>) map ).entryList().iterator();
|
||||
public static <K,V> Iterable<Map.Entry<K,V>> entriesIterable(Map<K,V> map) {
|
||||
return ( (IdentityMap<K,V>) map ).entryList();
|
||||
}
|
||||
|
||||
public static <K,V> Iterator<K> keyIterator(Map<K,V> map) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user