commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zoly farkas <zolyfar...@yahoo.com>
Subject issues with org.apache.commons.pool2.performance. PerformanceTest
Date Thu, 20 Jan 2011 02:13:21 GMT
the use volatiles : waiting,complete,totalBorrowTime, totalReturnTime, nrSamples 
is not correct.


for ex the following totalBorrowTime += borrowTime is not atomic resulting in a 
race condition.

one way to fix this is using the java.util.concurent Atomic variants or even 
better,
make these variables members of MyThread and aggregate them at the end of the 
test, 
this way there will be no need to use Atomic and thus increasing efficiency, and 
accuracy of the test of the test.

also:

private boolean start;

needs to be volatile, due to visibility issue.
(when updating start other threads might not pick up the value)


cheers

--Zoltan


      

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


Mime
View raw message