Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ArrayList concurrent use of add and remove

807588May 12 2009 — edited May 16 2009
Hi

I am using an ArrayList to collect monitoring information for a web service. Each time the web service is called the time that it took to process is added to the ArrayList. The web service calls can be concurrent. Every 5 minutes the ArrayList is cleared (via clear()). I know that any structural changes to an ArrayList should be synchronized, but we are concerned about the performance implications. Also we do not require 100% accurate monitoring stats, but rather an indication (stats are retrieved via JMX). If we do not synchronize the add() and clear() operations is there a possibility of exceptions occurring under heavy load? If no exceptions occur, to what extend would the collected results be inaccurate?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2009
Added on May 12 2009
21 comments
982 views