8231968: getCurrentThreadAllocatedBytes default implementation s/b getThreadAllocatedBytes
Pass Thread.currentThread().getId() to getThreadAllocatedBytes, remove its implSpec Reviewed-by: dholmes, mchung, sspitsyn
This commit is contained in:
parent
3f50e2563e
commit
68e5c40f6f
@ -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 14
|
||||
*/
|
||||
public default long getCurrentThreadAllocatedBytes() {
|
||||
throw new UnsupportedOperationException();
|
||||
return getThreadAllocatedBytes(Thread.currentThread().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user