public class Monitor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.lang.Object |
syncOn
An object to synchronize on
|
protected static Monitor |
theMonitor
The variable to synchronize on
|
Modifier and Type | Method and Description |
---|---|
static Monitor |
getMonitor()
Return the monitor instance.
|
java.lang.Object |
getSyncOn()
Get an object to synchronize on.
|
void |
lock()
Lock current thread on this monitor.
|
void |
release()
Release locked threads.
|
static void |
restartThread(java.lang.Thread theThread,
boolean startNew)
Re-start the thread running depending on its current state.
|
static void |
stopThread(java.lang.Thread theThread)
Re-start the thread running depending on its current state.
|
protected static final java.lang.Object syncOn
protected static final Monitor theMonitor
public static Monitor getMonitor()
public java.lang.Object getSyncOn()
public void lock()
public void release()
public static void stopThread(java.lang.Thread theThread)
theThread
- the thread to stop.public static void restartThread(java.lang.Thread theThread, boolean startNew)
theThread
- the thread to start.startNew
- true if start a new thread for the first time.