public class LockUtil extends Object
Constructor and Description |
---|
LockUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
createLockFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path lockFile,
boolean accept)
Create a lock file.
|
static boolean |
removeLockFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path lockFile)
Remove lock file.
|
public static void createLockFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.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(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path lockFile) throws IOException
fs
- filesystemlockFile
- lock file nameIOException
- if lock file exists but it is a directory.Copyright © 2014 The Apache Software Foundation