Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit efc1cf6

Browse files
authored
Merge pull request Netflix#1485 from Netflix/avoid-array-allocation-ResponseCacheImpl
avoid array allocation in ResponseCacheImpl
2 parents 191cc40 + 14c5103 commit efc1cf6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

eureka-core/src/main/java/com/netflix/eureka/registry/ResponseCacheImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
* @author Karthik Ranganathan, Greg Kim
7575
*/
7676
public class ResponseCacheImpl implements ResponseCache {
77+
private static final Key.KeyType[] KEY_TYPE_VALUES = Key.KeyType.values();
78+
private static final Version[] VERSION_VALUES = Version.values();
7779

7880
private static final Logger logger = LoggerFactory.getLogger(ResponseCacheImpl.class);
7981

@@ -249,8 +251,8 @@ public void stop() {
249251
*/
250252
@Override
251253
public void invalidate(String appName, @Nullable String vipAddress, @Nullable String secureVipAddress) {
252-
for (Key.KeyType type : Key.KeyType.values()) {
253-
for (Version v : Version.values()) {
254+
for (Key.KeyType type : KEY_TYPE_VALUES) {
255+
for (Version v : VERSION_VALUES) {
254256
invalidate(
255257
new Key(Key.EntityType.Application, appName, type, v, EurekaAccept.full),
256258
new Key(Key.EntityType.Application, appName, type, v, EurekaAccept.compact),

0 commit comments

Comments
 (0)