cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CXF-5016) ArithmeticException on ResponseTimeCounterMBean.getAvgResponseTime() after counter reset()
Date Fri, 31 May 2013 08:05:20 GMT

     [ https://issues.apache.org/jira/browse/CXF-5016?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Freeman Fang resolved CXF-5016.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0.0
                   2.7.6
                   2.6.9
                   2.5.11

commit fix
http://svn.apache.org/r1486838 for trunk
http://svn.apache.org/r1486847 for 2.7.x branch
http://svn.apache.org/r1486849 for 2.6.x branch
http://svn.apache.org/r1487180 for 2.5.x branch
                
> ArithmeticException on ResponseTimeCounterMBean.getAvgResponseTime() after counter reset()
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-5016
>                 URL: https://issues.apache.org/jira/browse/CXF-5016
>             Project: CXF
>          Issue Type: Bug
>          Components: Management
>    Affects Versions: 2.7.0
>            Reporter: Emmanuel FOUCHE
>            Assignee: Freeman Fang
>            Priority: Minor
>             Fix For: 2.5.11, 2.6.9, 2.7.6, 3.0.0
>
>
> A JMX client program such as monitoring platform (Nagios plugin, HypericHQ, ...) retrieve
metrics like AvgResponseTime per minute.
> One way to retrieve data is to fetch value every minute and reset counter immediately
after.
> However, if no calls to the service has been made since last reset, you get an ArithmeticException
"divide by zero" when calling ResponseTimeCounterMBean.getAvgResponseTime()
> I suggest handling this case by returning 0 or -1 instead, thus avoiding exception and
alarming stacktrace on the monitoring client side.
> {code:title=ResponseTimeCounter.getAvgResponseTime()}
> public Number getAvgResponseTime() {        
>   if (_invocations.get() == 0) {
>      return -1; // avoid divide by 0;
>   }
>   return (int)(totalHandlingTime / invocations.get());
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message