[seam-issues] [JBoss JIRA] (JBSEAM-4997) Deadlock with components using factories of each other

Marek Schmidt (JIRA) jira-events at lists.jboss.org
Tue Jul 10 04:26:12 EDT 2012


Marek Schmidt created JBSEAM-4997:
-------------------------------------

             Summary: Deadlock with components using factories of each other
                 Key: JBSEAM-4997
                 URL: https://issues.jboss.org/browse/JBSEAM-4997
             Project: Seam 2
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.3.0.BETA2
         Environment: Seam 2.3.0.CR1-SNAPSHOT r14979, AS 7.1.2.Final
            Reporter: Marek Schmidt
            Assignee: Marek Novotny


The patch in JBSEAM-4861 introduced a potential deadlock with components using each other factories, such as in the following sample:

{code}
@Scope(ScopeType.APPLICATION)
@Name("factoryLock.knitFactory")
public static class KnitFactory
{
   @Factory(value="factoryLock.knitPurl", scope=ScopeType.SESSION)
   public String getDoubleKnit() {
      return "knit(" + (String)Component.getInstance("factoryLock.purl") + ")";
   }
      
   @Factory(value="factoryLock.knit", scope=ScopeType.SESSION)
   public String getKnit() {
      return "knit";
   }
}
   
@Scope(ScopeType.APPLICATION)
@Name("factoryLock.purlFactory")
public static class PurlFactory
{
   @Factory(value="factoryLock.purlKnit", scope=ScopeType.SESSION)
   public String getDoublePurl() {
      return "purl(" + (String)Component.getInstance("factoryLock.knit") + ")";
   }
      
   @Factory(value="factoryLock.purl", scope=ScopeType.SESSION)
   public String getPurl() {
      return "purl";
   }
}
{code}

this may cause a deadlock if two different requests in the same session ask for #{factoryLock.knitPurl} and #{factoryLock.purlKnit} respectively.

The problem is that different threads may lock the components in different order.


--
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 seam-issues mailing list