[seam-commits] Seam SVN: r8775 - trunk/src/main/org/jboss/seam/core.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Aug 22 05:44:00 EDT 2008
Author: shane.bryzak at jboss.com
Date: 2008-08-22 05:44:00 -0400 (Fri, 22 Aug 2008)
New Revision: 8775
Modified:
trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java
Log:
JBSEAM-3295
Modified: trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java 2008-08-22 09:19:08 UTC (rev 8774)
+++ trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java 2008-08-22 09:44:00 UTC (rev 8775)
@@ -1,6 +1,8 @@
//$Id$
package org.jboss.seam.core;
+import java.util.concurrent.atomic.AtomicInteger;
+
import org.jboss.seam.Component;
import org.jboss.seam.annotations.intercept.AroundInvoke;
import org.jboss.seam.annotations.intercept.Interceptor;
@@ -21,38 +23,35 @@
private static final long serialVersionUID = 4686458105931528659L;
private static final LogProvider log = Logging.getLogProvider(BijectionInterceptor.class);
+
+ private AtomicInteger reentrantCounter = new AtomicInteger();
- private boolean reentrant; //OK, since all Seam components are single-threaded
-
@AroundInvoke
public Object aroundInvoke(InvocationContext invocation) throws Exception
{
- if (reentrant)
+ Component component = getComponent();
+ try
{
- if ( log.isTraceEnabled() )
+ if ( log.isTraceEnabled() && reentrantCounter.get() > 0 )
{
log.trace("reentrant call to component: " + getComponent().getName() );
}
- return invocation.proceed();
+
+ reentrantCounter.incrementAndGet();
+ boolean enforceRequired = !component.isLifecycleMethod( invocation.getMethod() );
+ component.inject( invocation.getTarget(), enforceRequired );
+ Object result = invocation.proceed();
+ component.outject( invocation.getTarget(), enforceRequired );
+
+ return result;
+
}
- else
+ finally
{
- reentrant = true;
- try
+ if (reentrantCounter.decrementAndGet() == 0)
{
- Component component = getComponent();
- boolean enforceRequired = !component.isLifecycleMethod( invocation.getMethod() );
- component.inject( invocation.getTarget(), enforceRequired );
- Object result = invocation.proceed();
- component.outject( invocation.getTarget(), enforceRequired );
component.disinject( invocation.getTarget() );
- return result;
-
}
- finally
- {
- reentrant = false;
- }
}
}
More information about the seam-commits
mailing list