gnodet-bot commented on code in PR #30576:
URL: https://github.com/apache/camel/pull/30576#discussion_r4658330762


##########
components/camel-file/src/main/java/org/apache/camel/component/file/cluster/FileLockClusterView.java:
##########
@@ -241,6 +257,42 @@ private HeldLock takeOver(long gen) {
     private void closeInternal() {
         releaseFileLock();
         closeLockFiles();
+        unregisterLockPath(lockPathKey);
+        lockPathKey = null;

Review Comment:
   ⚠️ **Low severity / docs-only:** `closeInternal()` reads `lockPathKey` here 
without `stateLock`. The access is safe by sequencing — `closeInternal()` is 
called from `doStart()` under `contextStartLock`, before the first 
`scheduleTryLock()`, so no concurrent `acquireLock()` can be writing 
`lockPathKey` at this point. Consider a brief inline comment so future readers 
don't have to reconstruct this invariant:
   
   ```suggestion
           // Safe without stateLock: closeInternal() is only called from 
doStart() under contextStartLock,
           // before the first scheduleTryLock(), so no concurrent 
acquireLock() writes lockPathKey here.
           unregisterLockPath(lockPathKey);
           lockPathKey = null;
   ```



-- 
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]

Reply via email to