Author: manaRH
Date: 2012-07-31 09:24:28 -0400 (Tue, 31 Jul 2012)
New Revision: 15009
Modified:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/Component.java
Log:
JBPAPP-9391 locking on factoryMethod to reduce deadlock possibility
Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/Component.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/Component.java 2012-07-30
15:18:02 UTC (rev 15008)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/Component.java 2012-07-31
13:24:28 UTC (rev 15009)
@@ -2076,7 +2076,6 @@
else if (factoryMethod != null && getOutScope(factoryMethod.getScope(),
factoryMethod.getComponent()).isContextActive())
{
Object factory =
Component.getInstance(factoryMethod.getComponent().getName(), true);
- Component component = factoryMethod.getComponent();
ScopeType scopeResult = getOutScope(factoryMethod.getScope(),
factoryMethod.getComponent());
ScopeType scopeFactory = factoryMethod.getComponent().getScope();
// we need this lock in the following cases: (1) the target scope is
@@ -2099,23 +2098,12 @@
// synchronize all instances of this component as they might
// outject to the same scope (i.e. component factory in EVENT scope,
// outjecting to APPLICATION scope).
- if (scopeResult == ScopeType.CONVERSATION || scopeResult ==
ScopeType.EVENT || scopeResult == ScopeType.PAGE)
+ //System.out.println("^^^^^ factoryMethod " + factoryMethod);
+ synchronized (factoryMethod)
{
- synchronized (factory)
- {
- return createInstanceFromFactory(name, scope, factoryMethod,
factory);
- }
+ //System.out.println("^^^^^ factoryMethod locked");
+ return createInstanceFromFactory(name, scope, factoryMethod, factory);
}
- // synchronize all instances of this factory as they might
- // outject to the same scope (i.e. factory in EVENT scope,
- // outjecting to APPLICATION scope).
- else
- {
- synchronized (component)
- {
- return createInstanceFromFactory(name, scope, factoryMethod,
factory);
- }
- }
}
else
{
Show replies by date