@@ -44,15 +44,18 @@ public List<String> eurekaServiceUrls() {
44
44
}
45
45
46
46
public int grayReleaseRuleScanInterval () {
47
- return getIntProperty ("apollo.gray-release-rule-scan.interval" , 60 );
47
+ int interval = getIntProperty ("apollo.gray-release-rule-scan.interval" , 60 );
48
+ return checkInt (interval , 1 , Integer .MAX_VALUE , 60 );
48
49
}
49
50
50
51
public int itemKeyLengthLimit () {
51
- return getIntProperty ("item.key.length.limit" , 128 );
52
+ int limit = getIntProperty ("item.key.length.limit" , 128 );
53
+ return checkInt (limit , 5 , Integer .MAX_VALUE , 128 );
52
54
}
53
55
54
56
public int itemValueLengthLimit () {
55
- return getIntProperty ("item.value.length.limit" , 20000 );
57
+ int limit = getIntProperty ("item.value.length.limit" , 20000 );
58
+ return checkInt (limit , 5 , Integer .MAX_VALUE , 20000 );
56
59
}
57
60
58
61
public Map <Long , Integer > namespaceValueLengthLimitOverride () {
@@ -82,34 +85,46 @@ public String cloggingPort() {
82
85
}
83
86
84
87
public int appNamespaceCacheScanInterval () {
85
- return getIntProperty ("apollo.app-namespace-cache-scan.interval" , 1 );
88
+ int interval = getIntProperty ("apollo.app-namespace-cache-scan.interval" , 1 );
89
+ return checkInt (interval , 1 , Integer .MAX_VALUE , 1 );
86
90
}
87
91
88
92
public TimeUnit appNamespaceCacheScanIntervalTimeUnit () {
89
93
return TimeUnit .SECONDS ;
90
94
}
91
95
92
96
public int appNamespaceCacheRebuildInterval () {
93
- return getIntProperty ("apollo.app-namespace-cache-rebuild.interval" , 60 );
97
+ int interval = getIntProperty ("apollo.app-namespace-cache-rebuild.interval" , 60 );
98
+ return checkInt (interval , 1 , Integer .MAX_VALUE , 60 );
94
99
}
95
100
96
101
public TimeUnit appNamespaceCacheRebuildIntervalTimeUnit () {
97
102
return TimeUnit .SECONDS ;
98
103
}
99
104
100
105
public int releaseMessageCacheScanInterval () {
101
- return getIntProperty ("apollo.release-message-cache-scan.interval" , 1 );
106
+ int interval = getIntProperty ("apollo.release-message-cache-scan.interval" , 1 );
107
+ return checkInt (interval , 1 , Integer .MAX_VALUE , 1 );
102
108
}
103
109
104
110
public TimeUnit releaseMessageCacheScanIntervalTimeUnit () {
105
111
return TimeUnit .SECONDS ;
106
112
}
107
113
108
114
public int releaseMessageNotificationBatch () {
109
- return getIntProperty ("apollo.release-message.notification.batch" , 100 );
115
+ int batch = getIntProperty ("apollo.release-message.notification.batch" , 100 );
116
+ return checkInt (batch , 1 , Integer .MAX_VALUE , 100 );
110
117
}
111
118
112
119
public int releaseMessageNotificationBatchIntervalInMilli () {
113
- return getIntProperty ("apollo.release-message.notification.batch.interval" , 100 );
120
+ int interval = getIntProperty ("apollo.release-message.notification.batch.interval" , 100 );
121
+ return checkInt (interval , 1 , Integer .MAX_VALUE , 100 );
122
+ }
123
+
124
+ int checkInt (int value , int min , int max , int defaultValue ) {
125
+ if (value >= min && value <= max ) {
126
+ return value ;
127
+ }
128
+ return defaultValue ;
114
129
}
115
130
}
0 commit comments