@@ -40,6 +40,8 @@ public class DynamicConfigPropertiesWatcher implements DisposableBean {
4040 private static final long NORMAL_FILE_POLLING_INTERVAL = 90000 ;
4141 private static final String FILE_COLON_SYMBOL = "file:" ;
4242 private static final String SYMBOL_LINK_DIR = "..data" ;
43+ private static final String WATCH_THREAD = "config-watcher" ;
44+ private static final String POLLING_THREAD = "config-watcher-polling" ;
4345 private static final String FILE_SOURCE_CONFIGURATION_PATTERN = "^.*Config\\ sresource.*file.*$" ;
4446 private static final String FILE_SOURCE_CONFIGURATION_PATTERN_LEGACY = "^.+Config:\\ s\\ [file:.*$" ;
4547 private static final Map <String , PropertySourceMeta > PROPERTY_SOURCE_META_MAP = new HashMap <>(8 );
@@ -83,7 +85,7 @@ public void watchConfigDirectory() {
8385 normalizeAndRecordPropSource (ps );
8486 }
8587 }
86- Executors .newSingleThreadExecutor (r -> new Thread (r , "config-watcher" )).submit (this ::startWatchDir );
88+ Executors .newSingleThreadExecutor (r -> new Thread (r , WATCH_THREAD )).submit (this ::startWatchDir );
8789 }
8890
8991 /**
@@ -142,11 +144,11 @@ private void checkChangesWithPeriod() throws IOException {
142144 if (hasDotDataLinkFile ) {
143145 log .info ("ConfigMap/Secret mode detected, will polling symbolic link instead." );
144146 symbolicLinkModifiedTime = Files .getLastModifiedTime (symLinkPath , LinkOption .NOFOLLOW_LINKS ).toMillis ();
145- Executors .newSingleThreadScheduledExecutor (r -> new Thread (r , "config-watcher-polling" )).scheduleWithFixedDelay (
147+ Executors .newSingleThreadScheduledExecutor (r -> new Thread (r , WATCH_THREAD )).scheduleWithFixedDelay (
146148 this ::checkSymbolicLink , SYMBOL_LINK_POLLING_INTERVAL , SYMBOL_LINK_POLLING_INTERVAL , TimeUnit .MILLISECONDS );
147149 } else {
148150 // longer check for all config files, make up mechanism if WatchService doesn't work
149- Executors .newSingleThreadScheduledExecutor (r -> new Thread (r , "config-watcher-polling" )).scheduleWithFixedDelay (
151+ Executors .newSingleThreadScheduledExecutor (r -> new Thread (r , WATCH_THREAD )).scheduleWithFixedDelay (
150152 this ::reloadAllConfigFiles , NORMAL_FILE_POLLING_INTERVAL , NORMAL_FILE_POLLING_INTERVAL , TimeUnit .MILLISECONDS );
151153 }
152154 }
0 commit comments