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

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

No worries about IBM JDK. 

As for {{ConfiguredObjectAttributeInjector}} invocation for every type, it 
happens because injectors are not type specific. When object is created, we get 
attributes/fields/etc for the object type class by calling 
{{model.getTypeRegistry().getAttributeTypes(getClass())}} in constructor of 
{{AbstractConfiguredObject}}. It happens only once for every type (see 
{{ConfiguredObjectTypeRegistry.processClassIfNecessary}}). A number of 
{ConfiguredObjectTypeRegistry#process*}}  methods are called to discover the 
information about the type which includes calling all attribute injectors. It 
seems that by design, the attribute injector can declare 
attributes/statistics/etc for multiple types (whatever is accepted by 
TypeValidator)

The following stack trace illustrates the problem:

{noformat}
at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:341)
        at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
        at 
java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
        at 
org.apache.qpid.server.model.BrokerAttributeInjector.makeMethodAccessible(BrokerAttributeInjector.java:496)
        at 
org.apache.qpid.server.model.BrokerAttributeInjector.getMethodAndMakeItAccessible(BrokerAttributeInjector.java:482)
        at 
org.apache.qpid.server.model.BrokerAttributeInjector.getInjectedStatistics(BrokerAttributeInjector.java:253)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.processMethods(ConfiguredObjectTypeRegistry.java:826)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.process(ConfiguredObjectTypeRegistry.java:764)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.processClassIfNecessary(ConfiguredObjectTypeRegistry.java:1289)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.getAttributeTypes(ConfiguredObjectTypeRegistry.java:1329)
        at 
org.apache.qpid.server.model.AbstractConfiguredObject.<init>(AbstractConfiguredObject.java:266)
        at 
org.apache.qpid.server.model.AbstractConfiguredObject.<init>(AbstractConfiguredObject.java:246)
        at 
org.apache.qpid.server.model.AbstractConfiguredObject.<init>(AbstractConfiguredObject.java:238)
        at 
org.apache.qpid.server.exchange.AbstractExchange.<init>(AbstractExchange.java:140)

{noformat}

I think that in order to call injector only once per type it possibly make 
sence to make it type specific. What do you think?


was (Author: alex.rufous):
No worries about IBM JDK. 

As for {{ConfiguredObjectAttributeInjector}} invocation for every type, it 
happens because injectors are not type specific. When object is created, we get 
attributes/fields/etc for the object type class by calling 
{{model.getTypeRegistry().getAttributeTypes(getClass())}} in constructor of 
{{AbstractConfiguredObject}}. It happens only once for every type (see 
{{ConfiguredObjectTypeRegistry.processClassIfNecessary}}). A number of 
{ConfiguredObjectTypeRegistry#process*}}  methods are called to discover the 
information about the type which includes calling all attribute injectors. It 
seems that by design, the attribute injector can declare 
attributes/sttatistics/etc for multiple types.

The following stack trace illustrates the problem:

{noformat}
at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:341)
        at 
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
        at 
java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
        at 
org.apache.qpid.server.model.BrokerAttributeInjector.makeMethodAccessible(BrokerAttributeInjector.java:496)
        at 
org.apache.qpid.server.model.BrokerAttributeInjector.getMethodAndMakeItAccessible(BrokerAttributeInjector.java:482)
        at 
org.apache.qpid.server.model.BrokerAttributeInjector.getInjectedStatistics(BrokerAttributeInjector.java:253)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.processMethods(ConfiguredObjectTypeRegistry.java:826)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.process(ConfiguredObjectTypeRegistry.java:764)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.processClassIfNecessary(ConfiguredObjectTypeRegistry.java:1289)
        at 
org.apache.qpid.server.model.ConfiguredObjectTypeRegistry.getAttributeTypes(ConfiguredObjectTypeRegistry.java:1329)
        at 
org.apache.qpid.server.model.AbstractConfiguredObject.<init>(AbstractConfiguredObject.java:266)
        at 
org.apache.qpid.server.model.AbstractConfiguredObject.<init>(AbstractConfiguredObject.java:246)
        at 
org.apache.qpid.server.model.AbstractConfiguredObject.<init>(AbstractConfiguredObject.java:238)
        at 
org.apache.qpid.server.exchange.AbstractExchange.<init>(AbstractExchange.java:140)

{noformat}

I think that in order to call injector only once per type it possibly make 
sence to make it type specific. What do you think?

> [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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to