Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-6381

ConcurrentModification in UnifiedLoaderRepository3 packagesMap

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • No Release
    • JBossAS-4.2.3.GA
    • ClassLoading
    • None

      The UnifiedLoaderRepository3 has an internal packagesMap
      which is currently a

      ConcurrentHashMap<String, TreeSet<UnfiedClassLoader>>

      where the TreeSet uses a comparator based on the PkgClassLoader/UnifiedClassLoader order.

      This TreeSet is not properly synchronized against changes, e.g. (un)deployment of a classloader that
      has a certain package while somebody is trying to load a class from that package.

      This can lead to a

      java.util.ConcurrentModificationException
      at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
      at java.util.HashMap$KeyIterator.next(HashMap.java:877)
      at java.util.AbstractCollection.addAll(AbstractCollection.java:318)
      at java.util.TreeSet.addAll(TreeSet.java:258)
      at org.jboss.mx.loading.UnifiedLoaderRepository3.getPackageClassLoaders(UnifiedLoaderRepository3.java:246)
      at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:178)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
      at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)

      Rather than synchronizing the TreeSet, I'd suggest using a CopyOnWriteList whose
      contents are presorted like the TreeSet.

              starksm64 Scott Stark (Inactive)
              adrian.brock Adrian Brock (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: