public final class SleepingLockWrapper extends FilterDirectory
This is not a good idea.
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_POLL_INTERVAL
How long
obtainLock(java.lang.String) waits, in milliseconds,
in between attempts to acquire the lock. |
static long |
LOCK_OBTAIN_WAIT_FOREVER
Pass this lockWaitTimeout to try forever to obtain the lock.
|
in
Constructor and Description |
---|
SleepingLockWrapper(Directory delegate,
long lockWaitTimeout)
Create a new SleepingLockFactory
|
SleepingLockWrapper(Directory delegate,
long lockWaitTimeout,
long pollInterval)
Create a new SleepingLockFactory
|
Modifier and Type | Method and Description |
---|---|
Lock |
obtainLock(String lockName)
Acquires and returns a
Lock for a file with the given name. |
String |
toString() |
close, createOutput, createTempOutput, deleteFile, fileLength, getDelegate, getPendingDeletions, listAll, openInput, rename, sync, syncMetaData, unwrap
copyFrom, ensureOpen, openChecksumInput
public static final long LOCK_OBTAIN_WAIT_FOREVER
public static long DEFAULT_POLL_INTERVAL
obtainLock(java.lang.String)
waits, in milliseconds,
in between attempts to acquire the lock.public SleepingLockWrapper(Directory delegate, long lockWaitTimeout)
delegate
- underlying directory to wraplockWaitTimeout
- length of time to wait in milliseconds
or LOCK_OBTAIN_WAIT_FOREVER
to retry forever.public SleepingLockWrapper(Directory delegate, long lockWaitTimeout, long pollInterval)
delegate
- underlying directory to wraplockWaitTimeout
- length of time to wait in milliseconds
or LOCK_OBTAIN_WAIT_FOREVER
to retry forever.pollInterval
- poll once per this interval in milliseconds until
lockWaitTimeout
is exceeded.public Lock obtainLock(String lockName) throws IOException
Directory
Lock
for a file with the given name.obtainLock
in class FilterDirectory
lockName
- the name of the lock fileLockObtainFailedException
- (optional specific exception) if the lock could
not be obtained because it is currently held elsewhere.IOException
- if any i/o error occurs attempting to gain the lockpublic String toString()
toString
in class FilterDirectory
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.