• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • DSO:L1
  • hhuynh
  • Reporter: amiller
  • February 03, 2009
  • 1
  • Watchers: 5
  • January 14, 2010
  • November 23, 2009

Description

Currently, CopyOnWriteArrayList and Set are non-portable. We investigated this a bit and it would not be hard to physically instrument these classes and provide at least base level support for them. This was requested to support tim-wicket for wicket 1.4. It would be nice if we could include this in the next 2.7.x if possible.

Some notes here (see comments): http://tech.puredanger.com/2009/02/02/copyonwritearraylist-concurrency-fun/

I messed with this a little and was able to work around the permanent exclude and see something basically working. Some minimum necessities:

  • make the internal transient array field clustered
  • make existing synchronized methods write locked
  • make existing array() method (used for read-only methods) synchronized and read-locked
  • add to boot jar

Tim also suggested that some of our internal support volatiles may make this easier to implement.

Comments

Fiona OShea 2009-02-26

I’m taking a wild guess that you wan this to be in Quintara and next 2.7?

Alex Miller 2009-02-26

Yeah, it would help the wicket guys and it seems like a reasonably good thing for us to add. But we don’t have any commitment to do it.

Alex Miller 2009-06-09

Decided to instrument logically (although it was kind of a toss-up). Some reasons why:

  • lower memory footprint (but not a big deal)
  • there are different implementations of COWAL in jdk 1.5 / 1.6 - one uses synchronized and newer uses ReentrantLock

Things to do:

  • Add to BootJarTool.addInstrumentedJavaUtilCollection()
  • Add spec in same places as other logical lists
  • Remove from ExcludesConfiguration
  • Add config somewhere
    • Make syncronized methods read/write locked
    • Make lock instance a clustered lock instance in 1.6 - need applicator and a state object ListManagedObjectState also needs to contain a lock object Extend ListManagedObjectState and contain new field for the lock
  • Add tests to GenericListTest, GenericSetTest

Hung Huynh 2009-11-21

CopyOnWriteArrayList is now supported.

Working on CopyOnWriteArraySet

Kalai Kannaiyan 2009-12-07

Verified that the CopyOnWriteArrayList, CopyOnWriteArraySet classes are added in the boot jar with Terracotta 3.2.0-nightly, as of 20091207-081213 (Revision 14149 by cruise@su10mo4 from 3.2)