public class JGitFileSystemLock { | |
... | |
void physicalLockOnFS() { | |
try { | |
File file = lockFile.toFile(); | |
RandomAccessFile raf = new RandomAccessFile(file, | |
"rw"); | |
fileChannel = raf.getChannel(); | |
physicalLock = fileChannel.lock(); | |
fileChannel.position(0); | |
fileChannel.write(ByteBuffer.wrap("locked".getBytes())); | |
} catch (Exception e) { | |
LOGGER.error("Error during lock of FS [" + toString() + "]", | |
e); | |
throw new RuntimeException(e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment