zjt0926 opened a new pull request, #11609: URL: https://github.com/apache/rocketmq/pull/11609
### Which Issue(s) This PR Fixes Fixes #11608 ### Brief Description `FileWatchService` only registered watch targets that already existed when the service was constructed. `run0()` re-hashes only the paths stored in `currentHash`, so a configured file that did not exist at startup was never watched: when it was created later (for example a TLS certificate provisioned or mounted after the process started), `Listener.onChanged` was never invoked and the dynamic TLS certificate reload never happened. `md5Digest()` already returns an empty hash for a missing file and reuses the previous hash for a deleted file, so the `exists()` check in the constructor is not required. All non-empty configured paths are now registered, and a later-created file is detected on the next watch round. Behaviour for deleted files is unchanged: the deletion itself does not produce an event, and a subsequent re-creation with different content does. ### How Did You Test This Change? Added `FileWatchServiceTest#watchSingleFile_CreatedAfterStart`, which constructs the service with a non-existent path, creates the file after the service starts and asserts that the listener is called. - `mvn -pl srvutil -am "-Dtest=FileWatchServiceTest" test` - passed (Tests run: 6, Failures: 0, Errors: 0) - `mvn -pl srvutil validate` (project checkstyle) - 0 violations -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
