Browse Source

CachingMetadataReaderFactory releases shared cache Map on clearCache()

LocalResourceCache properly initializes cacheLimit on construction.

Issue: SPR-17527

(cherry picked from commit 262c702da4)
pull/23430/head
Juergen Hoeller 7 years ago
parent
commit
23d1049363
  1. 7
      spring-core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java

7
spring-core/src/main/java/org/springframework/core/type/classreading/CachingMetadataReaderFactory.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -149,6 +149,10 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory { @@ -149,6 +149,10 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory {
this.metadataReaderCache.clear();
}
}
else if (this.metadataReaderCache != null) {
// Shared resource cache -> reset to local cache.
setCacheLimit(DEFAULT_CACHE_LIMIT);
}
}
@ -159,6 +163,7 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory { @@ -159,6 +163,7 @@ public class CachingMetadataReaderFactory extends SimpleMetadataReaderFactory {
public LocalResourceCache(int cacheLimit) {
super(cacheLimit, 0.75f, true);
this.cacheLimit = cacheLimit;
}
public void setCacheLimit(int cacheLimit) {

Loading…
Cancel
Save