This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 7d0d971621 don't delete lock file when lock is held by other (#11324)
7d0d971621 is described below

commit 7d0d971621c71e4b3786052302787f0209354979
Author: Lin ZiHao <[email protected]>
AuthorDate: Thu Jan 19 10:04:58 2023 +0800

    don't delete lock file when lock is held by other (#11324)
    
    Co-authored-by: 林子豪 <[email protected]>
---
 .../main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
index a49f19a474..773be9f546 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/cache/FileCacheStoreFactory.java
@@ -168,7 +168,6 @@ public final class FileCacheStoreFactory {
 
     private static void tryFileLock(FileCacheStore.Builder builder, String 
fileName) throws PathNotExclusiveException {
         File lockFile = new File(fileName + ".lock");
-        lockFile.deleteOnExit();
 
         FileLock dirLock;
         try {
@@ -188,6 +187,7 @@ public final class FileCacheStoreFactory {
             throw new PathNotExclusiveException(fileName + " is not exclusive. 
Maybe multiple Dubbo instances are using the same folder.");
         }
 
+        lockFile.deleteOnExit();
         builder.directoryLock(dirLock).lockFile(lockFile);
     }
 

Reply via email to