Showing
1 changed file
with
5 additions
and
5 deletions
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.service.install.update; |
17 | 17 | |
18 | +import lombok.RequiredArgsConstructor; | |
18 | 19 | import lombok.extern.slf4j.Slf4j; |
19 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
20 | 21 | import org.springframework.cache.Cache; |
... | ... | @@ -24,13 +25,13 @@ import org.springframework.stereotype.Service; |
24 | 25 | |
25 | 26 | import java.util.Objects; |
26 | 27 | |
28 | +@RequiredArgsConstructor | |
27 | 29 | @Service |
28 | 30 | @Profile("install") |
29 | 31 | @Slf4j |
30 | 32 | public class DefaultCacheCleanupService implements CacheCleanupService { |
31 | 33 | |
32 | - @Autowired | |
33 | - CacheManager cacheManager; | |
34 | + private final CacheManager cacheManager; | |
34 | 35 | |
35 | 36 | /** |
36 | 37 | * Cleanup caches that can not deserialize anymore due to schema upgrade or data update using sql scripts. |
... | ... | @@ -43,7 +44,7 @@ public class DefaultCacheCleanupService implements CacheCleanupService { |
43 | 44 | case "3.0.1": |
44 | 45 | log.info("Clear cache to upgrade from version 3.0.1 to 3.1.0 ..."); |
45 | 46 | clearAllCaches(); |
46 | - //do not break to show explicit calls for next versions | |
47 | + break; | |
47 | 48 | case "3.1.1": |
48 | 49 | log.info("Clear cache to upgrade from version 3.1.1 to 3.2.0 ..."); |
49 | 50 | clearCacheByName("devices"); |
... | ... | @@ -55,10 +56,9 @@ public class DefaultCacheCleanupService implements CacheCleanupService { |
55 | 56 | clearCacheByName("deviceProfiles"); |
56 | 57 | clearCacheByName("tenantProfiles"); |
57 | 58 | clearCacheByName("relations"); |
58 | - | |
59 | 59 | break; |
60 | 60 | default: |
61 | - throw new RuntimeException("Unable to update cache, unsupported fromVersion: " + fromVersion); | |
61 | + //Do nothing, since cache cleanup is optional. | |
62 | 62 | } |
63 | 63 | } |
64 | 64 | ... | ... |