@InterfaceAudience.Private public interface InterProcessLock
Modifier and Type | Interface and Description |
---|---|
static interface |
InterProcessLock.MetadataHandler
An interface for objects that process lock metadata.
|
Modifier and Type | Method and Description |
---|---|
void |
acquire()
Acquire the lock, waiting indefinitely until the lock is released or
the thread is interrupted.
|
void |
reapAllLocks()
If supported, attempts to reap all the locks of this type by forcefully
deleting the locks (both held and attempted).
|
void |
reapExpiredLocks(long expireTimeoutMs)
If supported, attempts to reap all the locks of this type by forcefully
deleting the locks (both held and attempted) that have expired according
to the given timeout.
|
void |
release()
Release the lock.
|
boolean |
tryAcquire(long timeoutMs)
Acquire the lock within a wait time.
|
void |
visitLocks(InterProcessLock.MetadataHandler handler)
Visits the locks (both held and attempted) of this type with the given
InterProcessLock.MetadataHandler . |
void acquire() throws IOException, InterruptedException
IOException
- If there is an unrecoverable error releasing the lockInterruptedException
- If current thread is interrupted while
waiting for the lockboolean tryAcquire(long timeoutMs) throws IOException, InterruptedException
timeoutMs
- The maximum time (in milliseconds) to wait for the lock,
-1 to wait indefinitelyIOException
- If there is an unrecoverable error talking talking
(e.g., when talking to a lock service) when acquiring
the lockInterruptedException
- If the thread is interrupted while waiting to
acquire the lockvoid release() throws IOException, InterruptedException
IOException
- If there is an unrecoverable error releasing the lockInterruptedException
- If the thread is interrupted while releasing
the lockvoid reapExpiredLocks(long expireTimeoutMs) throws IOException
IOException
- If there is an unrecoverable error reaping the locksvoid reapAllLocks() throws IOException
reapExpiredLocks(long)
with timeout=0.IOException
- If there is an unrecoverable error reaping the locksvoid visitLocks(InterProcessLock.MetadataHandler handler) throws IOException
InterProcessLock.MetadataHandler
.IOException
- If there is an unrecoverable errorCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.