Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6355660

(coll) Vector(Collection) constructor is not thread safe

XMLWordPrintable

      Academic researchers often go looking for concurrency bugs,
      and when investigating the Java libraries, the Vector(Collection)
      constructor is usually the first one they find. E.g.

      http://www.cs.sunysb.edu/~liqiang/atomicity-introduction.htm
      http://www.soe.ucsc.edu/~cormac/papers/tldi05.ps

      Pretty much any user expects that, since Vector is synchronized
      and "thread-safe", then the following is safe:

      Collection c = new Vector();
      // Mutate c wildly
      Vector v = new Vector(c);

      Of course, Vector cannot assume that its argument is not being
      concurrently mutated. Fortunately, c.toArray() is perfect for
      initializing Vector's own internal array.

      This is part of the fix for
      6347106: (coll) methods taking concurrently modified collection arguments fail sporadically

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: