-
Sub-task
-
Resolution: Delivered
-
P4
-
23
The JVMTI `GetObjectMonitorUsage` function returns the following data structure:
```
typedef struct {
jthread owner;
jint entry_count;
jint waiter_count;
jthread* waiters;
jint notify_waiter_count;
jthread* notify_waiters;
} jvmtiMonitorUsage;
```
Two fields in this structure are specified as:
- `waiter_count` [`jint`]: The number of threads waiting to own this monitor
- `waiters` [`jthread*`]: The `waiter_count` waiting threads
In previous releases, the `waiters` field included the threads waiting to enter or re-enter the monitor as specified, but also (incorrectly) the threads waiting to be notified in `java.lang.Object.wait()`. That has been fixed in the current release. The `waiter_count` always matches the returned number of threads in the `waiters` field.
Also, the JDWP `ObjectReference.MonitorInfo` command spec was updated to clarify what the `waiters` threads are:
> `waiters`: "The total number of threads that are waiting to enter or re-enter the monitor, or waiting to be notified by the monitor."
The behavior of this JDWP command is kept the same, and is intentionally different to `GetObjectMonitorUsage`.
```
typedef struct {
jthread owner;
jint entry_count;
jint waiter_count;
jthread* waiters;
jint notify_waiter_count;
jthread* notify_waiters;
} jvmtiMonitorUsage;
```
Two fields in this structure are specified as:
- `waiter_count` [`jint`]: The number of threads waiting to own this monitor
- `waiters` [`jthread*`]: The `waiter_count` waiting threads
In previous releases, the `waiters` field included the threads waiting to enter or re-enter the monitor as specified, but also (incorrectly) the threads waiting to be notified in `java.lang.Object.wait()`. That has been fixed in the current release. The `waiter_count` always matches the returned number of threads in the `waiters` field.
Also, the JDWP `ObjectReference.MonitorInfo` command spec was updated to clarify what the `waiters` threads are:
> `waiters`: "The total number of threads that are waiting to enter or re-enter the monitor, or waiting to be notified by the monitor."
The behavior of this JDWP command is kept the same, and is intentionally different to `GetObjectMonitorUsage`.
- relates to
-
JDK-8324677 incorrect implementation of JVM TI GetObjectMonitorUsage
- Closed