Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-762

ConcurrentModificationException in MediaTypeMap.convert()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 2.3.4.Final
    • None

      AbstractRestAdapterClient.java
      /**
       * Initializes the REST adapter.
       */
      public AbstractRestAdapterClient() {
         ResteasyProviderFactory instance = ResteasyProviderFactory.getInstance();
              List<MessageBodyReader<?>> messageBodyReaders = getMessageBodyReaders();
              for (MessageBodyReader<?> reader : messageBodyReaders) {
                  instance.addMessageBodyReader(reader);
              }
              RegisterBuiltin.register(instance);
      

      If quite a lot rest clients are created in parallel we disocver the following exception sometimes. It's not deterministic.

      Caused by: java.util.ConcurrentModificationException
      	at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372) [rt.jar:1.6.0_32]
      	at java.util.AbstractList$Itr.next(AbstractList.java:343) [rt.jar:1.6.0_32]
      	at org.jboss.resteasy.core.MediaTypeMap.convert(MediaTypeMap.java:301) [resteasy-jaxrs-2.3.4.Final.jar:]
      	at org.jboss.resteasy.core.MediaTypeMap.add(MediaTypeMap.java:282) [resteasy-jaxrs-2.3.4.Final.jar:]
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:517) [resteasy-jaxrs-2.3.4.Final.jar:]
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:494) [resteasy-jaxrs-2.3.4.Final.jar:]
      	at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:484) [resteasy-jaxrs-2.3.4.Final.jar:]
      	at org.jboss.resteasy.core.ThreadLocalResteasyProviderFactory.addMessageBodyReader(ThreadLocalResteasyProviderFactory.java:303) [resteasy-jaxrs-2.3.4.Final.jar:]
      

              weli@redhat.com Weinan Li
              schlikkes Thomas Schilk (Inactive)
              Votes:
              6 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: