diff --git a/eureka-core/src/main/java/com/netflix/eureka/registry/ResponseCacheImpl.java b/eureka-core/src/main/java/com/netflix/eureka/registry/ResponseCacheImpl.java index 3d498e4bd..863e6bea4 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/registry/ResponseCacheImpl.java +++ b/eureka-core/src/main/java/com/netflix/eureka/registry/ResponseCacheImpl.java @@ -74,6 +74,8 @@ * @author Karthik Ranganathan, Greg Kim */ public class ResponseCacheImpl implements ResponseCache { + private static final Key.KeyType[] KEY_TYPE_VALUES = Key.KeyType.values(); + private static final Version[] VERSION_VALUES = Version.values(); private static final Logger logger = LoggerFactory.getLogger(ResponseCacheImpl.class); @@ -249,8 +251,8 @@ public void stop() { */ @Override public void invalidate(String appName, @Nullable String vipAddress, @Nullable String secureVipAddress) { - for (Key.KeyType type : Key.KeyType.values()) { - for (Version v : Version.values()) { + for (Key.KeyType type : KEY_TYPE_VALUES) { + for (Version v : VERSION_VALUES) { invalidate( new Key(Key.EntityType.Application, appName, type, v, EurekaAccept.full), new Key(Key.EntityType.Application, appName, type, v, EurekaAccept.compact),