public class LockUtil extends Object
Constructor and Description |
---|
LockUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
createLockFile(FileSystem fs,
Path lockFile,
boolean accept)
Create a lock file.
|
static boolean |
removeLockFile(FileSystem fs,
Path lockFile)
Remove lock file.
|
public static void createLockFile(FileSystem fs, Path lockFile, boolean accept) throws IOException
fs
- filesystemlockFile
- name of the lock fileaccept
- if true, and the target file exists, consider it valid. If false
and the target file exists, throw an IOException.IOException
- if accept is false, and the target file already exists, or if
it's a directory.public static boolean removeLockFile(FileSystem fs, Path lockFile) throws IOException
fs
- filesystemlockFile
- lock file nameIOException
- if lock file exists but it is a directory.Copyright © 2015 The Apache Software Foundation