|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@InterfaceAudience.Private public interface InterProcessLock
An interface for an application-specific lock.
Nested Class Summary | |
---|---|
static interface |
InterProcessLock.MetadataHandler
An interface for objects that process lock metadata. |
Method Summary | |
---|---|
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 . |
Method Detail |
---|
void acquire() throws IOException, InterruptedException
IOException
- If there is an unrecoverable error releasing the lock
InterruptedException
- 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 indefinitely
IOException
- If there is an unrecoverable error talking talking
(e.g., when talking to a lock service) when acquiring
the lock
InterruptedException
- If the thread is interrupted while waiting to
acquire the lockvoid release() throws IOException, InterruptedException
IOException
- If there is an unrecoverable error releasing the lock
InterruptedException
- 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
.
InterruptedException
- If there is an unrecoverable error
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |