public static interface ReadWriteProcessLock.Lock
| Modifier and Type | Method and Description |
|---|---|
void |
lock()
Acquires the lock, blocking to wait until the lock can be acquired.
|
boolean |
tryLock(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Tries acquiring the lock, blocking to wait until the lock can be acquired or the
specified time has passed, then returns
true in the first case and false
in the second case. |
void |
unlock()
Releases the lock.
|
void lock() throws java.io.IOException
If the thread executing this method is interrupted, this method will throw a runtime exception.
java.io.IOExceptionboolean tryLock(long timeout,
@NonNull
java.util.concurrent.TimeUnit timeUnit)
throws java.io.IOException
true in the first case and false
in the second case.
If the thread executing this method is interrupted, this method will throw a runtime exception.
This method will try acquiring the lock first before checking for timeout. A
non-positive timeout means the method will return immediately after the first try. This
behavior is similar to a ReentrantReadWriteLock.
timeout - the maximum time to wait for the locktimeUnit - the unit of the timeouttrue if the lock was acquiredjava.io.IOExceptionvoid unlock()
throws java.io.IOException
java.io.IOException