how to pass Thread id to get getThreadCpuTime or getThreadAllocatedBytes ?

classic Classic list List threaded Threaded
1 message Options
ekar ekar
Reply | Threaded
Open this post in threaded view
|

how to pass Thread id to get getThreadCpuTime or getThreadAllocatedBytes ?

Hi,

Query: http://localhost:7777/jolokia/read/java.lang:type=Threading/AllThreadIds

Output:

{"request":{"mbean":"java.lang:type=Threading","attribute":"AllThreadIds","type":"read"},"value":[481,480,451,151,150,149,148,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,97,96,95,94,93,91,87,86,85,84,83,81,47,46,45,44,42,41,40,39,38,37,30,29,28,27,26,25,24,23,20,19,18,17,16,14,13,12,5,3,2,1],"timestamp":1566284441,"status":200}

Query1: http://localhost:7777/jolokia/exec/java.lang:type=Threading/getThreadCpuTime()

Output1:

{"request":{"mbean":"java.lang:type=Threading","type":"exec","operation":"getThreadCpuTime"},"stacktrace":"java.lang.IllegalArgumentException: Operation getThreadCpuTime on MBean java.lang:type=Threading is overloaded. Signatures found: ([J),(long). Use a signature when specifying the operation.\n\tat org.jolokia.handler.ExecHandler.extractOperationTypes(ExecHandler.java:139)\n\tat org.jolokia.handler.ExecHandler.doHandleRequest(ExecHandler.java:84)\n\tat org.jolokia.handler.ExecHandler.doHandleRequest(ExecHandler.java:40)\n\tat org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:89)\n\tat org.jolokia.backend.MBeanServerExecutorLocal.handleRequest(MBeanServerExecutorLocal.java:109)\n\tat org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:161)\n\tat org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:99)\n\tat org.jolokia.backend.BackendManager.callRequestDispatcher(BackendManager.java:429)\n\tat org.jolokia.backend.BackendManager.handleRequest(BackendManager.java:158)\n\tat org.jolokia.http.HttpRequestHandler.executeRequest(HttpRequestHandler.java:197)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:86)\n\tat org.jolokia.jvmagent.handler.JolokiaHttpHandler.executeGetRequest(JolokiaHttpHandler.java:276)\n\tat org.jolokia.jvmagent.handler.JolokiaHttpHandler.doHandle(JolokiaHttpHandler.java:233)\n\tat org.jolokia.jvmagent.handler.JolokiaHttpHandler.handle(JolokiaHttpHandler.java:178)\n\tat com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)\n\tat sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)\n\tat com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)\n\tat sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)\n\tat com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)\n\tat sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\n","error_type":"java.lang.IllegalArgumentException","error":"java.lang.IllegalArgumentException : Operation getThreadCpuTime on MBean java.lang:type=Threading is overloaded. Signatures found: ([J),(long). Use a signature when specifying the operation.","status":400}

Query2: http://localhost:7777/jolokia/exec/java.lang:type=Threading/getThreadCpuTime(1)

Output2:

{"request":{"mbean":"java.lang:type=Threading","type":"exec","operation":"getThreadCpuTime(1)"},"stacktrace":"java.lang.IllegalArgumentException: No operation getThreadCpuTime(1) on MBean java.lang:type=Threading exists. Known signatures: ([J),(long)\n\tat org.jolokia.handler.ExecHandler.extractOperationTypes(ExecHandler.java:148)\n\tat org.jolokia.handler.ExecHandler.doHandleRequest(ExecHandler.java:84)\n\tat org.jolokia.handler.ExecHandler.doHandleRequest(ExecHandler.java:40)\n\tat org.jolokia.handler.JsonRequestHandler.handleRequest(JsonRequestHandler.java:89)\n\tat org.jolokia.backend.MBeanServerExecutorLocal.handleRequest(MBeanServerExecutorLocal.java:109)\n\tat org.jolokia.backend.MBeanServerHandler.dispatchRequest(MBeanServerHandler.java:161)\n\tat org.jolokia.backend.LocalRequestDispatcher.dispatchRequest(LocalRequestDispatcher.java:99)\n\tat org.jolokia.backend.BackendManager.callRequestDispatcher(BackendManager.java:429)\n\tat org.jolokia.backend.BackendManager.handleRequest(BackendManager.java:158)\n\tat org.jolokia.http.HttpRequestHandler.executeRequest(HttpRequestHandler.java:197)\n\tat org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:86)\n\tat org.jolokia.jvmagent.handler.JolokiaHttpHandler.executeGetRequest(JolokiaHttpHandler.java:276)\n\tat org.jolokia.jvmagent.handler.JolokiaHttpHandler.doHandle(JolokiaHttpHandler.java:233)\n\tat org.jolokia.jvmagent.handler.JolokiaHttpHandler.handle(JolokiaHttpHandler.java:178)\n\tat com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)\n\tat sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)\n\tat com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)\n\tat sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)\n\tat com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)\n\tat sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\n","error_type":"java.lang.IllegalArgumentException","error":"java.lang.IllegalArgumentException : No operation getThreadCpuTime(1) on MBean java.lang:type=Threading exists. Known signatures: ([J),(long)","status":400}

Documentation:

https://jolokia.org/reference/html/protocol.html#exec
https://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/ThreadMXBean.html

Thanks