[jboss-jira] [JBoss JIRA] (AS7-4976) Missing transaction isolation with EJB2.1 EntityBeans with pessimistic locking

Lennart Petersson (JIRA) jira-events at lists.jboss.org
Wed Jun 27 10:44:12 EDT 2012


    [ https://issues.jboss.org/browse/AS7-4976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703577#comment-12703577 ] 

Lennart Petersson commented on AS7-4976:
----------------------------------------

Looking into org.jboss.as.ejb3.component.entity.entitycache.ReferenceCountingEntityCache.release I see following:

    public synchronized void release(final EntityBeanComponentInstance instance, boolean success) {
        if (instance.isDiscarded()) {
            return;
        }
        if (instance.getPrimaryKey() == null) return;  // TODO: Should this be an Exception
        final CacheEntry cacheEntry = cache.get(instance.getPrimaryKey());
        if (cacheEntry == null) {
------> THIS IS WHERE EXCEPTION IS THROWN
            throw EjbLogger.EJB3_LOGGER.entityBeanInstanceNotFoundInCache(instance);
        }
        if (cacheEntry.replacedInstance != null) {
------> THIS SOUNDS LIKE THE PROBLEMATIC SITUATION BUT WE NEVER ARRIVES HERE DUE TO NULL CACHEENTRY 
            //this can happen if an entity is removed and a new entity with the same PK is added in a transactions
            if (instance == cacheEntry.replacedInstance) {
                if (success) {
                    cacheEntry.instance = cacheEntry.replacedInstance;
                } else if (cacheEntry.instance.isDiscarded()) {
                    //if the TX was a failure, and the previous instance has been discarded
                    //we just remove the entry and return
                    cache.remove(instance.getPrimaryKey());
                    return;
                }
                cacheEntry.replacedInstance = null;
            }
        }
...
...

This might be interesting, or not...

regards,

/L
                
> Missing transaction isolation with EJB2.1 EntityBeans with pessimistic locking
> ------------------------------------------------------------------------------
>
>                 Key: AS7-4976
>                 URL: https://issues.jboss.org/browse/AS7-4976
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: EJB
>    Affects Versions: 7.1.1.Final
>         Environment: Windows 7 Pro SP1 (64bit); JDK 1.6.0_31 (64bit); Oracle Database 11g Release 11.1.0.6.0 - 64bit Production; AS71.1Final / AS71.2 latest build 
>            Reporter: Klaus Benary
>            Assignee: Stuart Douglas
>              Labels: entitybean, transactionisolation
>             Fix For: 7.1.3.Final (EAP), 7.2.0.Alpha1
>
>         Attachments: JCTest-maven.zip, JCTest.zip
>
>
> On pessimistically locked EntityBeans, a transaction B can see the result of transaction A even if thransaction A threw an exception and thus did not commit.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list