title: Best approach to use in Java 6 for a List being accessed concurrently
body: <p>I have a List object being accessed by multiple threads. There is mostly one thread, and in some conditions two threads, that updates the list. There are one to five threads that can read from this list, depending on the number of user requests being processed.
  The list is not a queue of tasks to perform, it is a list of domain objects that are being retrieved and updated concurrently.</p>
  
  <p>Now there are several ways to make the access to this list thread-safe:<br>
  -use synchronized block<br>
  -use normal <em>Lock</em> (i.e. read and write ops share same lock)<br>
  -use <em>ReadWriteLock</em><br>
  -use one of the new <em>ConcurrentBLABLBA</em> collection classes </p>
  
  <p><strong>My question:</strong><br>
  What is the optimal approach to use, given that the cricital sections typically do not contain a lot of operations (mostly just adding/removing/inserting or getting elements from the list)?<br>
  Can you recommend another approach, not listed above?</p>
  
  <p><strong>Some constrains</strong><br>
  -optimal performance is critical, memory usage not so much<br>
  -it must be an ordered list (currently synchronizing on an <em>ArrayList</em>), although not a sorted list (i.e. not sorted using Comparable or Comparator, but according to insertion order)<br>
  -the list will is big, containing up to 100000 domain objects, thus using something like CopyOnWriteArrayList not feasible<br>
  -the write/update ciritical sections are typically very quick, doing simple add/remove/insert or replace (set)<br>
  -the read operations will do primarily a elementAt(index) call most of the time, although some read operations might do a binary search, or indexOf(element)<br>
  -no direct iteration over the list is done, though operation like indexOf(..) will traverse list  </p>