public interface WithMutexes
MutexSupport is a common implementation of this. mixin code frequently delegates to this, as shown in the test case's WithMutexesTest.SampleWithMutexesDelegatingMixin class
Modifier and Type | Method and Description |
---|---|
void |
acquireMutex(java.lang.String mutexId,
java.lang.String description)
acquires a mutex, if available, otherwise blocks on its becoming available;
caller must release after use
|
boolean |
hasMutex(java.lang.String mutexId)
returns true if the calling thread has the mutex with the given ID
|
void |
releaseMutex(java.lang.String mutexId)
releases a mutex, triggering another thread to use it or cleaning it up if no one else is waiting;
this should only be called by the mutex owner (thread)
|
boolean |
tryAcquireMutex(java.lang.String mutexId,
java.lang.String description)
acquires a mutex and returns true, if available; otherwise immediately returns false;
caller must release after use if this returns true
|
boolean hasMutex(java.lang.String mutexId)
void acquireMutex(java.lang.String mutexId, java.lang.String description) throws java.lang.InterruptedException
java.lang.InterruptedException
boolean tryAcquireMutex(java.lang.String mutexId, java.lang.String description)
void releaseMutex(java.lang.String mutexId)