com.bea.jvm
Interface ThreadSnapshot.Monitor

All Superinterfaces:
Describable
Enclosing interface:
ThreadSnapshot

public static interface ThreadSnapshot.Monitor
extends Describable

Interface representing a monitor from a specific thread snapshot. Due to the difficulty of giving a unique identification of a monitor without having to keep a direct reference to the Java object (thereby never freeing it for garbage collection), the identity of monitors can not be completely guaranteed. The SnapshotMonitor gives the following promise:

However, two SnapshotMonitors which have been produced from different ThreadSnapshot collections is not guaranteed to be equal, even if they actually refer to the same monitor in the JVM. Also, two SnapshotMonitors may have the same class and ID and still not refer to the same monitor in the JVM.

Author:
Magnus Ihse

Field Summary
static int LOCK_TYPE_FAT
          Monitor is a fat lock
static int LOCK_TYPE_NONE
          Monitor is not locked
static int LOCK_TYPE_RECURSIVE
          Monitor is recursively locked
static int LOCK_TYPE_THIN
          Monitor is a thin lock
static int LOCK_TYPE_UNKNOWN
          Monitor is locked with an unknown type
 
Method Summary
 java.lang.String getClassName()
          Return the fully qualified name of the class this monitor belongs to.
 long getID()
          Return the ID of this monitor.
 int getLockType()
          Return the type of this lock.
 java.lang.String getLockTypeString()
          Return a string describing the type of this lock.
 int getOwnerThreadID()
          Return the thread ID of the thread owning this lock.
 
Methods inherited from interface com.bea.jvm.Describable
getDescription
 

Field Detail

LOCK_TYPE_UNKNOWN

public static final int LOCK_TYPE_UNKNOWN
Monitor is locked with an unknown type

See Also:
Constant Field Values

LOCK_TYPE_NONE

public static final int LOCK_TYPE_NONE
Monitor is not locked

See Also:
Constant Field Values

LOCK_TYPE_THIN

public static final int LOCK_TYPE_THIN
Monitor is a thin lock

See Also:
Constant Field Values

LOCK_TYPE_FAT

public static final int LOCK_TYPE_FAT
Monitor is a fat lock

See Also:
Constant Field Values

LOCK_TYPE_RECURSIVE

public static final int LOCK_TYPE_RECURSIVE
Monitor is recursively locked

See Also:
Constant Field Values
Method Detail

getID

public long getID()
Return the ID of this monitor. The ID is a numerical value which is unique for monitors from a collection a ThreadSnapshots taken at the same time. No assumption can be made about IDs from Monitors taken from different snapshots.

Returns:
the ID of this monitor.

getClassName

public java.lang.String getClassName()
Return the fully qualified name of the class this monitor belongs to.

Returns:
the fully qualified class name of this monitor.

getLockType

public int getLockType()
Return the type of this lock. This is one of the constants definied in this interface. If getClassName() returns null, then this monitor might not have a specified lock type. In this case, LOCK_TYPE_NONE is returned.

Returns:
the type of this lock.

getLockTypeString

public java.lang.String getLockTypeString()
Return a string describing the type of this lock.

Returns:
a string describingthe type of this lock.
See Also:
getLockType()

getOwnerThreadID

public int getOwnerThreadID()
Return the thread ID of the thread owning this lock. The owner is the thread that currently has taken this lock. If this montitor is not held by any thread, its owner is null. This can happen for instance when a thread is waiting for notification on this monitor. Note that thread ID may be reused by a different thread on a later snapshot. For ThreadSnapshots returned in the same collection, you are guaranteed that this ID correspond exactly to the thread holding the lock at the time of the snapshot.

Returns:
the id of the thread holding this monitor.