[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...
Gavin King
gavin.king at jboss.com
Fri Dec 15 01:01:17 EST 2006
User: gavin
Date: 06/12/15 01:01:17
Modified: src/main/org/jboss/seam/interceptors
ManagedEntityIdentityInterceptor.java
Log:
better handling when tx rolls back
Revision Changes Path
1.16 +9 -6 jboss-seam/src/main/org/jboss/seam/interceptors/ManagedEntityIdentityInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ManagedEntityIdentityInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ManagedEntityIdentityInterceptor.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- ManagedEntityIdentityInterceptor.java 13 Dec 2006 04:54:19 -0000 1.15
+++ ManagedEntityIdentityInterceptor.java 15 Dec 2006 06:01:17 -0000 1.16
@@ -28,7 +28,7 @@
//TODO: cache much more - the list of fields, PassivatedEntity obects, etc
- private List<PassivatedEntity> list = new ArrayList<PassivatedEntity>();
+ private List<PassivatedEntity> passivatedEntities = new ArrayList<PassivatedEntity>();
@AroundInvoke
public Object aroundInvoke(InvocationContext ctx) throws Exception
@@ -40,9 +40,12 @@
}
finally
{
+ if ( !PassivatedEntity.isTransactionMarkedRollback() )
+ {
entityRefsToIds(ctx);
}
}
+ }
public void entityRefsToIds(InvocationContext ctx) throws Exception
{
@@ -68,7 +71,7 @@
PassivatedEntity pi = PassivatedEntity.createPassivatedEntity( value, field.getName() );
if (pi!=null)
{
- list.add(pi);
+ passivatedEntities.add(pi);
Reflections.set(field, bean, null);
}
}
@@ -80,11 +83,11 @@
public void entityIdsToRefs(InvocationContext ctx) throws Exception
{
- if ( list.size()>0 )
+ if ( passivatedEntities.size()>0 )
{
Object bean = ctx.getTarget();
Class beanClass = bean.getClass();
- for (PassivatedEntity pe: list)
+ for (PassivatedEntity pe: passivatedEntities)
{
Object reference = pe.toEntityReference();
if (reference!=null)
@@ -101,7 +104,7 @@
}
}
}
- list.clear();
+ passivatedEntities.clear();
}
}
More information about the jboss-cvs-commits
mailing list