commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David J. M. Karlsen" <da...@davidkarlsen.com>
Subject Trouble with commons-math
Date Thu, 25 Oct 2007 12:58:10 GMT
Hi folks!

I use DescriptiveStatistics - but it seems to fail under heavy usage.

The scenario:

I use commons math to track average response time in a spring interceptor.
The DescriptiveStatistics instance is held within an object instance.
All calls to this object is synchronized - I've triple-checked that.

Some times when I call

descriptiveStatistics.getMean()

it throws:

java.lang.IllegalArgumentException: begin + length > values.length
 	at 
org.apache.commons.math.stat.descriptive.AbstractUnivariateStatistic.test(AbstractUnivariateStatistic.java:89)
 	at 
org.apache.commons.math.stat.descriptive.moment.Mean.evaluate(Mean.java:131)
 	at 
org.apache.commons.math.stat.descriptive.DescriptiveStatisticsImpl.apply(DescriptiveStatisticsImpl.java:143)
 	at 
org.apache.commons.math.stat.descriptive.DescriptiveStatistics.getMean(DescriptiveStatistics.java:95)
 	at 
no.mypackage.spring.utils.ExecState.checkBadState(ExecState.java:89)
 	at 
no.mypackage.spring.utils.ExecutionTimeAdvice$3.execute(ExecutionTimeAdvice.java:179)
 	at 
org.apache.commons.collections.CollectionUtils.forAllDo(CollectionUtils.java:388)
 	at 
no.mypackage.spring.utils.ExecutionTimeAdvice.invoke(ExecutionTimeAdvice.java:174)
 	at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 	at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 	at $Proxy0.doSomething(Unknown Source)
 	at 
no.mypackage.spring.utils.ExecutionTimeAdviceTest$1.run(ExecutionTimeAdviceTest.java:47)
 	at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
 	at java.lang.Thread.run(Thread.java:479)



If I change my code so I only call getMean() when getN >= windowSize it 
seems to work OK.


part II of the code add's values (through the same object which has 
synchronized access) - and this fails from time to time too (!):


java.lang.ArrayIndexOutOfBoundsException at 
org.apache.commons.math.util.ResizableDoubleArray.addElement(ResizableDoubleArray.java:255)
 	at 
org.apache.commons.math.stat.descriptive.DescriptiveStatisticsImpl.addValue(DescriptiveStatisticsImpl.java:103)
 	at no.dnbnor.spring.utils.ExecState.addExecTime(ExecState.java:68)
 	at 
no.mypackage.spring.utils.ExecutionTimeAdvice$4.execute(ExecutionTimeAdvice.java:203)
 	at 
org.apache.commons.collections.CollectionUtils.forAllDo(CollectionUtils.java:388)
 	at 
no.mypackage.spring.utils.ExecutionTimeAdvice.invoke(ExecutionTimeAdvice.java:200)
 	at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 	at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 	at $Proxy0.doSomething(Unknown Source)
 	at 
no.mypackage.spring.utils.ExecutionTimeAdviceTest$1.run(ExecutionTimeAdviceTest.java:47)
 	at 
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
 	at java.lang.Thread.run(Thread.java:479)



Any pointers???



David J. M. Karlsen - +47 90 68 22 43
http://www.davidkarlsen.com
http://mp3.davidkarlsen.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message