Skip to content
Permalink
Browse files
8231968: getCurrentThreadAllocatedBytes default implementation s/b ge…
…tThreadAllocatedBytes

Pass Thread.currentThread().getId() to getThreadAllocatedBytes, remove its implSpec

Backport-of: 68e5c40
  • Loading branch information
Ekaterina Vergizova authored and Yuri Nesterenko committed Dec 4, 2020
1 parent 4881f8e commit e22699c816f8849d5afd4aa24d36e04ffbf41da4
Showing 1 changed file with 1 addition and 4 deletions.
@@ -122,9 +122,6 @@ public interface ThreadMXBean extends java.lang.management.ThreadMXBean {
* {@link #getThreadAllocatedBytes getThreadAllocatedBytes}(Thread.currentThread().getId());
* </pre></blockquote>
*
* @implSpec The default implementation throws
* {@code UnsupportedOperationException}.
*
* @return an approximation of the total memory allocated, in bytes, in
* heap memory for the current thread
* if thread memory allocation measurement is enabled;
@@ -141,7 +138,7 @@ public interface ThreadMXBean extends java.lang.management.ThreadMXBean {
* @since 13.0.6
*/
public default long getCurrentThreadAllocatedBytes() {
throw new UnsupportedOperationException();
return getThreadAllocatedBytes(Thread.currentThread().getId());
}

/**

1 comment on commit e22699c

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on e22699c Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.