public class Mutex
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DEBUG
For enable/disable mutex debugging
|
private boolean |
isLocked
Indicates if mutex already locked
|
private java.lang.String |
lastMutexInformation
Last mutex information (For printing)
|
private java.lang.Object |
lock
Lock link to the mutex
|
private java.lang.String |
lockerThreadID
Thread ID that have locked the mutex
|
| Constructor and Description |
|---|
Mutex()
Create a new instance of Mutex
|
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String |
createMutexInformation(java.lang.StackTraceElement traceCaller)
Compute the mutex information with the caller stack trace
|
private java.lang.String |
createThreadID()
Create current thread ID
|
void |
lock()
Lock the mutex
|
void |
unlock()
Unlock the mutex
|
private static final boolean DEBUG
private boolean isLocked
private java.lang.String lastMutexInformation
private final java.lang.Object lock
private java.lang.String lockerThreadID
private java.lang.String createMutexInformation(java.lang.StackTraceElement traceCaller)
traceCaller - Caller stack traceprivate java.lang.String createThreadID()
public void lock()
public void unlock()