public class DirLock extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DIR_LOCK_FILE |
Modifier and Type | Method and Description |
---|---|
org.apache.hadoop.fs.Path |
getLockFile() |
void |
release()
Release lock on dir by deleting the lock file.
|
static DirLock |
takeOwnershipIfStale(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dirToLock,
int lockTimeoutSec)
if the lock on the directory is stale, take ownership.
|
static DirLock |
tryLock(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir)
Get a lock on file if not already locked.
|
public static final String DIR_LOCK_FILE
public static DirLock tryLock(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) throws IOException
dir
- the dir on which to get a lockIOException
- if there were errorspublic static DirLock takeOwnershipIfStale(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dirToLock, int lockTimeoutSec)
public void release() throws IOException
IOException
public org.apache.hadoop.fs.Path getLockFile()
Copyright © 2023 The Apache Software Foundation. All rights reserved.