Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-17606

ActivationImpl doesn't seem thread safe

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 30.0.0.Final
    • None
    • JCA
    • None
    • ---
    • ---

    Description

      When looking into https://issues.jboss.org/browse/WFLY-10986 I had to figure out what was modifying org.jboss.jca.common.metadata.resourceadapter.ActivationImpl.connectionDefinitions and figure out what to synchronize on. There is a subclass org.jboss.as.connector.subsystems.resourceadapters.ModifiableResourceAdapter which adds the changes.

      ModifiableResourceAdapter correctly synchronizes when adding data, which is good, but really all the fields in ActivationImpl should be final to make sure they are safely published as I don't think the fields are ever overwritten (otherwise they should be volatile).

      Also, I think it is possible to get similar ConcurrentModificationExceptions in ActivationImpl's implementations of hashCode(), equals(), and toString() as they all end up iterating things which could be modified by ModifiableResourceAdapter. So these all really ought to be synchronized. If you don't want to do it in ActivationImpl itself, you can probably do so in ModifiableResourceAdapter, e.g.:

          @Override
          public synchronized int hashCode()
          {
              return super.hashCode();
          }
      
          @Override
          public synchronized boolean equals(Object obj)
          {
              return super.equals(obj);
          }
      
          @Override
          public synchronized String toString()
          {
              return super.toString();
          }
      

      Attachments

        Issue Links

          Activity

            People

              tadamski@redhat.com Tomasz Adamski
              tadamski@redhat.com Tomasz Adamski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: