[ 
https://issues.apache.org/jira/browse/CXF-2541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793426#action_12793426
 ] 

Cyrille Le Clerc edited comment on CXF-2541 at 12/21/09 11:52 PM:
------------------------------------------------------------------

I am not sure but I think the "org.apache.cxf.resource.operation.name" property 
should be set on the exchange rather than on the message in 
o.a.c.jaxrs.client.AbstractClient.setPlainOperationNameProperty() because 
o.a.c.management.interceptor.AbstractMessageResponseTimeInterceptor.increaseCounter()
 is looking on the exchange (see below).

Shall I commit the change ?

Cyrille


{code:title=AbstractClient.java : proposed version working on the exchange}
public class AbstractClient implements Client {
    ...
    protected void setPlainOperationNameProperty(Message outMessage, String 
name) {
        outMessage.getExchange().put("org.apache.cxf.resource.operation.name", 
name);
    }
}
{code}


{code:title=AbstractClient.java : current version working on the outMessage}
public class AbstractClient implements Client {
    ...
    protected void setPlainOperationNameProperty(Message outMessage, String 
name) {
        outMessage.put("org.apache.cxf.resource.operation.name", name);
    }
}
{code}


{code:title=AbstractMessageResponseTimeInterceptor.java : current version 
working on the exchange}
public abstract class AbstractMessageResponseTimeInterceptor extends 
AbstractPhaseInterceptor<Message> {
    ...
    private void increaseCounter(Exchange ex, MessageHandlingTimeRecorder mhtr) 
{
        ...
            if (operationName == null) {
                Object nameProperty = 
ex.get("org.apache.cxf.resource.operation.name");
                if (nameProperty != null) {
                    operationName = "\"" + nameProperty.toString() + "\"";
                }
            }
        ...
    }
{code}

      was (Author: cleclerc):
    I am not sure but I think the "org.apache.cxf.resource.operation.name" 
property should be set on the exchange rather than on the message in 
o.a.c.jaxrs.client.AbstractClient.setPlainOperationNameProperty() because 
o.a.c.management.interceptor.AbstractMessageResponseTimeInterceptor.increaseCounter()
 is looking on the exchange (see below).

Shall I commit the change ?

Cyrille


{code:title=AbstractClient.java : proposed version working on the exchange}
public class AbstractClient implements Client {
    ...
    protected void setPlainOperationNameProperty(Message outMessage, String 
name) {
        outMessage.getExchange().put("org.apache.cxf.resource.operation.name", 
name);
    }
}
{code}


{code:title=AbstractClient.java : current version working on the outMessage}
public class AbstractClient implements Client {
    ...
    protected void setPlainOperationNameProperty(Message outMessage, String 
name) {
        outMessage.put("org.apache.cxf.resource.operation.name", name);
    }
}
{code}


{code:title=AbstractMessageResponseTimeInterceptor.java : current version 
working on the exchange}
public abstract class AbstractMessageResponseTimeInterceptor extends 
AbstractPhaseInterceptor<Message> {
    ...
    private void increaseCounter(Exchange ex, MessageHandlingTimeRecorder mhtr) 
{
        ...
            if (operationName == null) {
                Object nameProperty = 
ex.get("org.apache.cxf.resource.operation.name");
                if (nameProperty != null) {
                    operationName = "\"" + nameProperty.toString() + "\"";
                }
            }
        ...
    }
  
> JMX Per Operation ResponseTime not collected for JAX-RS services
> ----------------------------------------------------------------
>
>                 Key: CXF-2541
>                 URL: https://issues.apache.org/jira/browse/CXF-2541
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.3
>            Reporter: Cyrille Le Clerc
>             Fix For: 2.2.6, 2.3
>
>         Attachments: CXF-2541-jaxrs-client.patch, cxf-2541.patch, 
> usage-of-OperationInfo-and-OperationResourceInfo.log
>
>
> The JMX ResponseTimeFeature does not work on a per operation basis for JAXRS 
> calls but works on a per Service basis.
> My understanding is that it works on a per service basis because both 
> o.a.c.jaxrs.JAXRSServiceImpl and o.a.c.service.ServiceImpl implement the same 
> o.a.c.service.Service interface and are indexed in the Exchange map at the 
> o.a.c.service.Service entry.
> On the other hand, it does not work on the per operation basis because 
> o.a.c.jaxrs.model.OperationResourceInfo and o.a.c.service.model.OperationInfo 
> do not implement a shared interface. Thus, the ResponseTimeFeature is 
> specific to SOAP operations and can not handle JAXRS 'operations'.
> A fix could be to introduce a shared Operation interface, to make both 
> OperationResourceInfo and OperationInfo implement this interface and to us 
> the interface as the key for the Exchange map instead of the current 
> OperationResourceInfo.class and OperationInfo.class.
> There are 30 "put()" & "get()" calls on OperationInfo.class. and 8 "put()" & 
> "get()" calls on OperationResourceInfo.class.
> I would be very pleased to propose a patch if the project is interested.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to