[ 
https://issues.apache.org/jira/browse/QPID-8376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16978322#comment-16978322
 ] 

Alex Rudyy edited comment on QPID-8376 at 11/20/19 12:03 PM:
-------------------------------------------------------------

[~rgodfrey], I understood why accessibility is changed for methods 
{{getProcessCpuTime}} and {{getProcessCpuLoad}}:  Oracle JVM throws access 
exception on attempt to invoke those native methods reflectively. What is 
interesting, the IBM JDK does not behave in that way, but, it has another issue 
with finding native methods {{getProcessCpuTime}} and {{getProcessCpuLoad}} 
using call {{Class#getDeclaredMethod}}. I attached a patch with several changes:
* replace  {{Class#getDeclaredMethod}} with {Class#getMethod}} to make IBM JDK 
happy
* catch RuntimeException on invocation of {{Method#setAccessible(true)}} for 
methods {{getProcessCpuTime}} and {{getProcessCpuLoad}}
* Replace call to {{BigDecimal.valueOf(Double.NaN)}} with 
{{BigDecimal.valueOf(-1L);}} as the former throws {{NumberFormatException}}

I added warn logging of exception on attempt to change accessibility. When 
running with JDK12, the exception is reported multiple times (for every 
configured object type) as BrokerAttributeInjector is called for every CO class 
:). It seems by design, but, the excessive logs  can be potentially an issue :)




was (Author: alex.rufous):
[~rgodfrey], I understood why accessibility is changed for methods 
{{getProcessCpuTime}} and {{getProcessCpuLoad}}:  Oracle JVM throws access 
exception on attempt to invoke those native methods reflectively. What is 
interesting, the IBM JDK does not behave in that way, but, it has another issue 
with finding native methods {{getProcessCpuTime}} and {{getProcessCpuLoad}} 
using call {{Class#getDeclaredMethod}}. I attached a patch with several changes:
* replace {Class#getMethod}} with {{Class#getDeclaredMethod}} to make IBM JDK 
happy
* catch RuntimeException on invocation of {{Method#setAccessible(true)}} for 
methods {{getProcessCpuTime}} and {{getProcessCpuLoad}}
* Replace call to {{BigDecimal.valueOf(Double.NaN)}} with 
{{BigDecimal.valueOf(-1L);}} as the former throws {{NumberFormatException}}

I added warn logging of exception on attempt to change accessibility. When 
running with JDK12, the exception is reported multiple times (for every 
configured object type) as BrokerAttributeInjector is called for every CO class 
:). It seems by design, but, the excessive logs  can be potentially an issue :)



> [Broker-J] Add Process CPU time to collected Broker statistics
> --------------------------------------------------------------
>
>                 Key: QPID-8376
>                 URL: https://issues.apache.org/jira/browse/QPID-8376
>             Project: Qpid
>          Issue Type: Improvement
>          Components: Broker-J
>            Reporter: Robert Godfrey
>            Assignee: Robert Godfrey
>            Priority: Minor
>             Fix For: qpid-java-broker-8.0.0
>
>         Attachments: 
> 0001-QPID-8376-Broker-J-Handle-InaccessibleObjectExceptio.patch
>
>
> As per 
> [this|http://qpid.2158936.n2.nabble.com/Broker-J-statistics-and-CPU-consumption-tp7687889.html]
>  discussion on the mailing list - add the ability to capture CPU time and CPU 
> load from the broker statistics (where available from the underlying JVM 
> platform.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to