Author: manaRH
Date: 2012-07-03 06:38:24 -0400 (Tue, 03 Jul 2012)
New Revision: 14977
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/Component.java
Log:
backported JBSEAM-4993, JBSEAM-4861 to Seam 2.2 - used component instead of
factory.getClass()
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/Component.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/Component.java 2012-07-03 10:34:31
UTC (rev 14976)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/Component.java 2012-07-03 10:38:24
UTC (rev 14977)
@@ -2076,6 +2076,7 @@
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
@@ -2095,9 +2096,9 @@
if (lockingNeeded)
{
- // Only one factory instance can access result scope
- // CONVERSATION / EVENT / PAGE anyway due to
- // the locking of the conversation.
+ // 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)
{
synchronized (factory)
@@ -2110,7 +2111,7 @@
// outjecting to APPLICATION scope).
else
{
- synchronized (factory.getClass())
+ synchronized (component)
{
return createInstanceFromFactory(name, scope, factoryMethod,
factory);
}
Show replies by date