[jboss-cvs] jboss-seam/src/main/org/jboss/seam/ejb ...
Gavin King
gavin.king at jboss.com
Wed Aug 2 13:50:26 EDT 2006
User: gavin
Date: 06/08/02 13:50:26
Modified: src/main/org/jboss/seam/ejb SeamInterceptor.java
Log:
fix JBSEAM-325, sfsb interceptor passivation
Revision Changes Path
1.41 +17 -8 jboss-seam/src/main/org/jboss/seam/ejb/SeamInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/ejb/SeamInterceptor.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- SeamInterceptor.java 26 Jul 2006 23:33:39 -0000 1.40
+++ SeamInterceptor.java 2 Aug 2006 17:50:26 -0000 1.41
@@ -30,7 +30,7 @@
* for a session bean component
*
* @author Gavin King
- * @version $Revision: 1.40 $
+ * @version $Revision: 1.41 $
*/
public class SeamInterceptor implements Serializable
{
@@ -38,7 +38,9 @@
private static final Log log = LogFactory.getLog(SeamInterceptor.class);
private final InterceptorType type;
- private final Component component;
+ private boolean isSeamComponent;
+ private String componentName;
+ private transient Component component;
/**
* Called when instatiated by EJB container
@@ -56,16 +58,22 @@
{
this.type = type;
this.component = component;
+ isSeamComponent = true;
}
@PostConstruct
public void postConstruct(InvocationContext invocation) throws Exception
{
+ //if instantiated by the EJB container, we
+ //still need to init the component reference
Object bean = invocation.getTarget();
if ( isSeamComponent(bean) )
{
- getSeamComponent(bean).initialize(bean);
+ component = getSeamComponent(bean);
+ component.initialize(bean);
+ isSeamComponent = true;
}
+
invoke(invocation, EventType.POST_CONSTRUCT);
}
@@ -79,11 +87,13 @@
public void prePassivate(InvocationContext invocation) throws Exception
{
invoke(invocation, EventType.PRE_PASSIVATE);
+ if (isSeamComponent) componentName = component.getName();
}
@PostActivate
public void postActivate(InvocationContext invocation) throws Exception
{
+ if (isSeamComponent) component = Component.forName(componentName);
invoke(invocation, EventType.POST_ACTIVATE);
}
@@ -95,7 +105,7 @@
private Object invoke(InvocationContext invocation, EventType invocationType) throws Exception
{
- if ( !isSeamComponent( invocation.getTarget() ) )
+ if ( !isSeamComponent )
{
//not a Seam component
return invocation.proceed();
@@ -124,19 +134,18 @@
private Object invokeInContexts(InvocationContext invocation, EventType eventType) throws Exception
{
- final Component component = getSeamComponent( invocation.getTarget() );
if ( isProcessInterceptors(component) )
{
if ( log.isTraceEnabled() )
{
- log.trace("intercepted: " + invocation.getMethod().getName());
+ log.trace("intercepted: " + component.getName() + '.' + invocation.getMethod().getName());
}
return new SeamInvocationContext( invocation, eventType, component.getInterceptors(type) ).proceed();
}
else {
if ( log.isTraceEnabled() )
{
- log.trace("not intercepted: " + invocation.getMethod().getName());
+ log.trace("not intercepted: " + component.getName() + '.' + invocation.getMethod().getName());
}
return invocation.proceed();
}
@@ -149,7 +158,7 @@
private boolean isSeamComponent(Object bean)
{
- return component!=null || Seam.getBeanClass( bean.getClass() )!=null;
+ return isSeamComponent || Seam.getBeanClass( bean.getClass() )!=null;
}
private Component getSeamComponent(Object bean)
More information about the jboss-cvs-commits
mailing list