public abstract class MonitorSupport extends Object
Constructor and Description |
---|
MonitorSupport() |
Modifier and Type | Method and Description |
---|---|
abstract void |
doRelockObject(Object obj,
Object lockData) |
protected abstract void |
doWait(Object obj,
long timeoutMillis) |
abstract boolean |
isLockedByAnyThread(Object obj)
Determines whether the object's monitor is locked by the current or any other thread.
|
abstract boolean |
isLockedByCurrentThread(Object obj)
Implements the semantics of
Thread.holdsLock(java.lang.Object) . |
abstract int |
maybeAdjustNewParkStatus(int status)
Called from
Unsafe.park when changing the current thread's state before parking the
thread. |
abstract void |
monitorEnter(Object obj)
Implements the semantics of the monitorenter bytecode.
|
abstract void |
monitorExit(Object obj)
Implements the semantics of the monitorexit bytecode.
|
abstract void |
notify(Object obj,
boolean notifyAll)
Implements the semantics of
Object.notify() and Object.notifyAll() . |
abstract Object |
prepareRelockObject(Object obj) |
static MonitorSupport |
singleton() |
void |
wait(Object obj,
long timeoutMillis)
Implements the semantics of
Object.wait(long) . |
public static MonitorSupport singleton()
public abstract void monitorEnter(Object obj)
public abstract void monitorExit(Object obj)
public abstract boolean isLockedByCurrentThread(Object obj)
Thread.holdsLock(java.lang.Object)
.public abstract boolean isLockedByAnyThread(Object obj)
public final void wait(Object obj, long timeoutMillis) throws InterruptedException
Object.wait(long)
.InterruptedException
protected abstract void doWait(Object obj, long timeoutMillis) throws InterruptedException
InterruptedException
public abstract void notify(Object obj, boolean notifyAll)
Object.notify()
and Object.notifyAll()
.public abstract int maybeAdjustNewParkStatus(int status)
Unsafe.park
when changing the current thread's state before parking the
thread. When the thread is parked due to a monitor operation, we need to alter the new thread
state so Thread.getState()
gives the expected result.