HHH-6862 Reuse cached entryArray of IdentityMap in StatefulPersistenceContext as much as possible
This commit is contained in:
parent
ad3afa4b7d
commit
d12396ee37
|
@ -1162,7 +1162,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
|
||||
//not found in case, proceed
|
||||
// iterate all the entities currently associated with the persistence context.
|
||||
for ( Entry<Object,EntityEntry> me : IdentityMap.entriesIterable( entityEntries ) ) {
|
||||
for ( Entry<Object,EntityEntry> me : IdentityMap.concurrentEntries( 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() ) ) {
|
||||
|
@ -1284,7 +1284,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
//Not found in cache, proceed
|
||||
for ( Entry<Object, EntityEntry> me : IdentityMap.entriesIterable( entityEntries ) ) {
|
||||
for ( Entry<Object, EntityEntry> me : IdentityMap.concurrentEntries( entityEntries ) ) {
|
||||
EntityEntry ee = me.getValue();
|
||||
if ( persister.isSubclassEntityName( ee.getEntityName() ) ) {
|
||||
Object instance = me.getKey();
|
||||
|
|
|
@ -187,7 +187,7 @@ public abstract class AbstractFlushingEventListener implements Serializable {
|
|||
LOG.debug( "Dirty checking collections" );
|
||||
|
||||
for ( Map.Entry<PersistentCollection,CollectionEntry> entry :
|
||||
IdentityMap.entriesIterable( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
IdentityMap.concurrentEntries( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
entry.getValue().preFlush( entry.getKey() );
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public abstract class AbstractFlushingEventListener implements Serializable {
|
|||
LOG.trace( "Processing unreferenced collections" );
|
||||
|
||||
for ( Map.Entry<PersistentCollection,CollectionEntry> me :
|
||||
IdentityMap.entriesIterable( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
IdentityMap.concurrentEntries( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
CollectionEntry ce = me.getValue();
|
||||
if ( !ce.isReached() && !ce.isIgnore() ) {
|
||||
Collections.processUnreachableCollection( me.getKey(), session );
|
||||
|
@ -259,7 +259,7 @@ public abstract class AbstractFlushingEventListener implements Serializable {
|
|||
|
||||
ActionQueue actionQueue = session.getActionQueue();
|
||||
for ( Map.Entry<PersistentCollection,CollectionEntry> me :
|
||||
IdentityMap.entriesIterable( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
IdentityMap.concurrentEntries( (Map<PersistentCollection,CollectionEntry>) persistenceContext.getCollectionEntries() )) {
|
||||
PersistentCollection coll = me.getKey();
|
||||
CollectionEntry ce = me.getValue();
|
||||
|
||||
|
|
|
@ -90,10 +90,6 @@ public final class IdentityMap<K,V> implements Map<K,V> {
|
|||
return ( (IdentityMap<K,V>) map ).entryArray();
|
||||
}
|
||||
|
||||
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) {
|
||||
return ( (IdentityMap<K,V>) map ).keyIterator();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue