Interface SharedMutex
- All Superinterfaces:
AutoCloseable, Closeable
A mutually exclusive lock, which may or may not be reentrant.
- Author:
- Christian Kohlschütter
-
Method Details
-
tryLock
Try to lock the mutex.Note that unless
isReentrant()is , trying to lock the mutex a second time will not succeed until someone else callsunlock()- Parameters:
timeoutMillis- The timeout, in milliseconds, or0for "try indefinitely".- Returns:
trueif the lock was acquired.- Throws:
IOException- on error.
-
unlock
Unlocks the mutex.By default, no ownership checks are performed.
- Throws:
IOException- on error.
-
isReentrant
boolean isReentrant()Reports if this lock instance is re-entrant, or not.The value returned is constant.
- Returns:
trueif reentrant.
-
isInterProcess
boolean isInterProcess()Reports if this lock instance can safely be accessed from multiple processes, or not. The actual way of accessing thisSharedMutexis unspecified, but typically this is coordinated viaSharedMemory.The value returned is constant.
- Returns:
trueif inter-process access is permitted.
-