public class SingleThreadedMonitorSupport extends MonitorSupport
Constructor and Description |
---|
SingleThreadedMonitorSupport() |
Modifier and Type | Method and Description |
---|---|
void |
doRelockObject(Object obj,
Object lockData) |
protected void |
doWait(Object obj,
long timeoutMillis) |
boolean |
isLockedByAnyThread(Object obj)
Determines whether the object's monitor is locked by the current or any other thread.
|
boolean |
isLockedByCurrentThread(Object obj)
Implements the semantics of
Thread.holdsLock(java.lang.Object) . |
int |
maybeAdjustNewParkStatus(int status)
Called from
Unsafe.park when changing the current thread's state before parking the
thread. |
void |
monitorEnter(Object obj)
Implements the semantics of the monitorenter bytecode.
|
void |
monitorExit(Object obj)
Implements the semantics of the monitorexit bytecode.
|
void |
notify(Object obj,
boolean notifyAll)
Implements the semantics of
Object.notify() and Object.notifyAll() . |
Object |
prepareRelockObject(Object obj) |
singleton, wait
public void monitorEnter(Object obj)
MonitorSupport
monitorEnter
in class MonitorSupport
public void monitorExit(Object obj)
MonitorSupport
monitorExit
in class MonitorSupport
public Object prepareRelockObject(Object obj)
prepareRelockObject
in class MonitorSupport
public void doRelockObject(Object obj, Object lockData)
doRelockObject
in class MonitorSupport
public boolean isLockedByCurrentThread(Object obj)
MonitorSupport
Thread.holdsLock(java.lang.Object)
.isLockedByCurrentThread
in class MonitorSupport
public boolean isLockedByAnyThread(Object obj)
MonitorSupport
isLockedByAnyThread
in class MonitorSupport
protected void doWait(Object obj, long timeoutMillis) throws InterruptedException
doWait
in class MonitorSupport
InterruptedException
public void notify(Object obj, boolean notifyAll)
MonitorSupport
Object.notify()
and Object.notifyAll()
.notify
in class MonitorSupport
public int maybeAdjustNewParkStatus(int status)
MonitorSupport
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.maybeAdjustNewParkStatus
in class MonitorSupport