[jboss-jira] [JBoss JIRA] (JBJCA-1384) ActivationImpl doesn't seem thread safe

Kabir Khan (JIRA) issues at jboss.org
Fri Sep 7 09:17:00 EDT 2018


Kabir Khan created JBJCA-1384:
---------------------------------

             Summary: ActivationImpl doesn't seem thread safe
                 Key: JBJCA-1384
                 URL: https://issues.jboss.org/browse/JBJCA-1384
             Project: IronJacamar
          Issue Type: Bug
            Reporter: Kabir Khan
            Priority: Critical


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.: 
{code}
    @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();
    }
{code}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list