|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface JavaMonitor
Represents the underlying monitor used by a Java Virtual Machine to manage locking and synchronization of a Java object.
The underlying monitor is implementation specific. Some implementations may choose to use their monitor implementations to
control access to Java Virtual Machine resources that are not objects. In such cases, getObject()
will return null.
Java programmers use the synchronized modifier on methods and the synchronized block within methods to control simultaneous access to Java objects. Java uses monitors for this synchronization, which can be implemented using a variety of techniques. The JavaMonitor class presents the simple monitor abstraction that allows the caller to determine:
This API presents only what exists at the Java Virtual Machine bytecode level. The locking facilities provided by the java.util.concurrent.lock
package are expected to be implemented on top of ordinary Java monitors.
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
java.util.List<JavaThread> |
getEnterWaiters()
Get the set of threads waiting to enter the monitor. |
ImagePointer |
getID()
Get the identifier for this monitor. |
java.lang.String |
getName()
Get the name of a monitor. |
java.util.List<JavaThread> |
getNotifyWaiters()
Get the set of threads waiting to be notified on the monitor. |
JavaObject |
getObject()
Get the object associated with this monitor. |
JavaThread |
getOwner()
Get the thread which currently owns the monitor. |
int |
hashCode()
|
Method Detail |
---|
JavaObject getObject()
Get the object associated with this monitor. Not all JavaMonitors will have objects, as there may be JavaMonitors that are used to control access to internal Java Virtual Machine resources ("Raw" monitors).
java.lang.String getName() throws CorruptDataException
Get the name of a monitor.
For monitors not associated with object ("raw" monitors), it is expected that this method will return a descriptive name that is meaningful to the Java Virtual Machine implementation. For example "Heap lock" might be a monitor controlling exclusive access to the Java heap.
For objects, the expectation is that the name will uniquely identify the object the monitor is associated with. This is not expected to necessarily be consistent between different dumps of the same JVM.
CorruptDataException
JavaThread getOwner() throws CorruptDataException
Get the thread which currently owns the monitor. This may be null if the monitor is not owned.
CorruptDataException
java.util.List<JavaThread> getEnterWaiters()
Get the set of threads waiting to enter the monitor.
The returned list follows the standard semantics for javax.tools.diagnostics collections.
The returned value is never null but can be an empty list.
JavaThread
,
CorruptData
java.util.List<JavaThread> getNotifyWaiters()
Get the set of threads waiting to be notified on the monitor.
They are usually threads in the Object.wait()
method.
The returned list follows the standard semantics for javax.tools.diagnostics collections.
The returned value is never null but can be an empty list.
JavaThread
,
CorruptData
ImagePointer getID()
Get the identifier for this monitor.
boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |