mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-16 05:15:22 +00:00
7032589: FileHandler leaking file descriptor of the file lock
Reviewed-by: forax, dcubed
This commit is contained in:
parent
16ddb7350c
commit
4ccabedd50
@ -409,22 +409,25 @@ public class FileHandler extends StreamHandler {
|
||||
// Try the next file.
|
||||
continue;
|
||||
}
|
||||
boolean available;
|
||||
try {
|
||||
FileLock fl = fc.tryLock();
|
||||
if (fl == null) {
|
||||
// We failed to get the lock. Try next file.
|
||||
continue;
|
||||
}
|
||||
available = fc.tryLock() != null;
|
||||
// We got the lock OK.
|
||||
} catch (IOException ix) {
|
||||
// We got an IOException while trying to get the lock.
|
||||
// This normally indicates that locking is not supported
|
||||
// on the target directory. We have to proceed without
|
||||
// getting a lock. Drop through.
|
||||
available = true;
|
||||
}
|
||||
// We got the lock. Remember it.
|
||||
locks.put(lockFileName, lockFileName);
|
||||
break;
|
||||
if (available) {
|
||||
// We got the lock. Remember it.
|
||||
locks.put(lockFileName, lockFileName);
|
||||
break;
|
||||
}
|
||||
|
||||
// We failed to get the lock. Try next file.
|
||||
fc.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user