Browse Source

DATACMNS-1364 - Polishing.

Use weak references in annotation and property annotation cache to retain references until the last GC root is cleared. Remove trailing whitespaces. Reformat.

Original pull request: #304.
pull/300/merge
Mark Paluch 8 years ago
parent
commit
e50e013964
  1. 6
      src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java

6
src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java

@ -38,6 +38,7 @@ import org.springframework.lang.Nullable; @@ -38,6 +38,7 @@ import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ConcurrentReferenceHashMap;
import org.springframework.util.ConcurrentReferenceHashMap.ReferenceType;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
@ -105,8 +106,9 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement @@ -105,8 +106,9 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
this.associations = comparator == null ? new HashSet<>() : new TreeSet<>(new AssociationComparator<>(comparator));
this.propertyCache = new HashMap<>();
this.annotationCache = new ConcurrentReferenceHashMap<>();
this.propertyAnnotationCache = CollectionUtils.toMultiValueMap(new ConcurrentReferenceHashMap<>());
this.annotationCache = new ConcurrentReferenceHashMap<>(16, ReferenceType.WEAK);
this.propertyAnnotationCache = CollectionUtils
.toMultiValueMap(new ConcurrentReferenceHashMap<>(16, ReferenceType.WEAK));
this.propertyAccessorFactory = BeanWrapperPropertyAccessorFactory.INSTANCE;
this.typeAlias = Lazy.of(() -> getAliasFromAnnotation(getType()));
this.isNewStrategy = Lazy.of(() -> Persistable.class.isAssignableFrom(information.getType()) //

Loading…
Cancel
Save