@Service(value="fileLockManager#default") public class DefaultFileLockManager extends Object implements FileLockManager
Modifier and Type | Field and Description |
---|---|
private static ConcurrentMap<File,Lock> |
lockFiles |
private org.slf4j.Logger |
log |
private boolean |
skipLocking |
private int |
timeout |
Constructor and Description |
---|
DefaultFileLockManager() |
Modifier and Type | Method and Description |
---|---|
void |
clearLockFiles() |
private void |
closeQuietly(RandomAccessFile randomAccessFile) |
private void |
createNewFileQuietly(File file) |
int |
getTimeout() |
boolean |
isSkipLocking() |
private boolean |
mkdirs(File directory) |
Lock |
readFileLock(File file) |
void |
release(Lock lock) |
void |
setSkipLocking(boolean skipLocking) |
void |
setTimeout(int timeout) |
Lock |
writeFileLock(File file) |
private static final ConcurrentMap<File,Lock> lockFiles
private boolean skipLocking
private org.slf4j.Logger log
private int timeout
public DefaultFileLockManager()
public Lock readFileLock(File file) throws FileLockException, FileLockTimeoutException
readFileLock
in interface FileLockManager
FileLockException
FileLockTimeoutException
public Lock writeFileLock(File file) throws FileLockException, FileLockTimeoutException
writeFileLock
in interface FileLockManager
FileLockException
FileLockTimeoutException
private void closeQuietly(RandomAccessFile randomAccessFile)
private void createNewFileQuietly(File file)
public void release(Lock lock) throws FileLockException
release
in interface FileLockManager
FileLockException
public void clearLockFiles()
clearLockFiles
in interface FileLockManager
public int getTimeout()
getTimeout
in interface FileLockManager
public void setTimeout(int timeout)
setTimeout
in interface FileLockManager
public boolean isSkipLocking()
isSkipLocking
in interface FileLockManager
public void setSkipLocking(boolean skipLocking)
setSkipLocking
in interface FileLockManager
Copyright © 2006–2023 The Apache Software Foundation. All rights reserved.