Git Product home page Git Product logo

Comments (6)

gpsre avatar gpsre commented on May 28, 2024 1

I am facing the same issue, using javamelody-spring-boot-starter 2.0.0.

Please change the implementation of MBeansAccessor.getThreadAllocatedBytes to the following. I opened a PR.

  static long getThreadAllocatedBytes(long threadId) {
        if (!isMbeanAllocatedBytesEnabled()) { // CHANGE THIS
            return -1L;
        }
        try {
            return (Long) MBEAN_SERVER.invoke(THREADING, "getThreadAllocatedBytes",
                    new Object[] { threadId }, THREAD_ALLOCATED_BYTES_SIGNATURE);
        } catch (final JMException e) {
            throw new IllegalStateException(e);
        }
    }

    // ADD THIS
    private boolean isMbeanAllocatedBytesEnabled() {
        try {
            Attribute supported = (Attribute) MBEAN_SERVER.getAttribute(THREADING, "ThreadAllocatedMemorySupported");
            Attribute enabled = (Attribute) MBEAN_SERVER.getAttribute(THREADING, "ThreadAllocatedMemoryEnabled");
            return ((boolean) supported.getValue()) && ((boolean) enabled.getValue());
        } catch (Exception ex) {
            // ignored
        }
        return false;
    }

from javamelody.

michaelknigge avatar michaelknigge commented on May 28, 2024 1

Same issue with newer versions of IBM Java 11:

java version "11.0.19" 2023-04-18
IBM Semeru Runtime Certified Edition for z/OS 11.0.19.0 (build 11.0.19+7)
IBM J9 VM 11.0.19.0 (build z/OS-Release-11.0.19.0-b01, JRE 11 z/OS s390x-64-Bit Compressed References 20230516_269 (JIT enabled, AOT enabled)
OpenJ9 - a92690a70a9
OMR - 9f28c98e431
IBM - 68444b7
JCL - 05b3cf78a01 based on jdk-11.0.19+7)

I would be very grateful for a new release of JavaMeldoy with the fix...

from javamelody.

evernat avatar evernat commented on May 28, 2024 1

PR reviewed

from javamelody.

wildberrylillet avatar wildberrylillet commented on May 28, 2024

relevant OpenJ9 commit

from javamelody.

gpsre avatar gpsre commented on May 28, 2024

Thank you, code adjusted according to review.

from javamelody.

wildberrylillet avatar wildberrylillet commented on May 28, 2024

Looks good, thank you!

from javamelody.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.