[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...
Gavin King
gavin.king at jboss.com
Mon Jan 8 14:10:03 EST 2007
User: gavin
Date: 07/01/08 14:10:03
Modified: src/main/org/jboss/seam/interceptors
BijectionInterceptor.java
Log:
fix JBSEAM-631
Revision Changes Path
1.26 +30 -3 jboss-seam/src/main/org/jboss/seam/interceptors/BijectionInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BijectionInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/BijectionInterceptor.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- BijectionInterceptor.java 21 Dec 2006 02:38:27 -0000 1.25
+++ BijectionInterceptor.java 8 Jan 2007 19:10:02 -0000 1.26
@@ -1,4 +1,4 @@
-//$Id: BijectionInterceptor.java,v 1.25 2006/12/21 02:38:27 sbryzak2 Exp $
+//$Id: BijectionInterceptor.java,v 1.26 2007/01/08 19:10:02 gavin Exp $
package org.jboss.seam.interceptors;
import static org.jboss.seam.util.EJB.POST_ACTIVATE;
@@ -22,13 +22,15 @@
*
* @author Gavin King
*/
- at Interceptor(stateless=true)
+ at Interceptor
public class BijectionInterceptor extends AbstractInterceptor
{
private static final long serialVersionUID = 4686458105931528659L;
private static final LogProvider log = Logging.getLogProvider(BijectionInterceptor.class);
+ private ThreadLocal<Boolean> reentrant = new ThreadLocal<Boolean>();
+
private static boolean isLifecycleMethod(Method method)
{
return method==null || //EJB 3 JavaDoc says InvocationContext.getMethod() returns null for lifecycle callbacks!
@@ -38,8 +40,33 @@
}
@AroundInvoke
- public Object bijectTargetComponent(InvocationContext invocation) throws Exception
+ public Object bijectComponent(InvocationContext invocation) throws Exception
+ {
+ if ( reentrant.get()!=null )
+ {
+ if ( log.isTraceEnabled() )
+ {
+ log.trace("reentrant call to component: " + getComponent().getName() );
+ }
+ return invocation.proceed();
+ }
+ else
+ {
+ reentrant.set(true);
+ try
{
+ return bijectNonreentrantComponent(invocation);
+ }
+ finally
+ {
+ reentrant.set(null);
+ }
+ }
+ }
+
+ private Object bijectNonreentrantComponent(InvocationContext invocation) throws Exception
+ {
+
if ( getComponent().needsInjection() ) //only needed to hush the log message
{
if ( log.isTraceEnabled() )
More information about the jboss-cvs-commits
mailing list