zer0Id0l
zer0Id0l

Reputation: 1444

Fetching info from JVM MBeans

I was trying to fetch the below details for my monitoring application using JVM MBeans

    thread-states.blocked
    thread-states.waiting
    gc.ConcurrentMarkSweep.runs
    gc.ParNew.runs
    thread_count
    daemon_thread_count
    memory.heap_usage
    memory.non_heap_usage

I am able to fetch most of them except

    thread-states.blocked
    thread-states.waiting
    gc.ConcurrentMarkSweep.runs
    gc.ParNew.runs

Does anybody know what MBean and attribute can be used to collect these values? PS: i have googled this before posting it here

Upvotes: 1

Views: 262

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240900

thread-states.blocked
thread-states.waiting

you can use getAllThreadIds() and get each Thread's information getThreadInfo() and filter based on the state

gc.ConcurrentMarkSweep.runs
gc.ParNew.runs

get getGarbageCollectorMXBeans() filter them for CMS and ParNew and getCollectionCount()

Upvotes: 2

Related Questions