User: patriot1burke
Date: 01/08/07 11:06:56
Modified: src/main/org/jboss/ejb/plugins
EntitySynchronizationInterceptor.java
Log:
- moved EntitySynchronizationInterceptor.storeEntity to EntityContainer
- moved synchronizeEntitiesWithinTransaction to EntityContainer and
made it a static method. Also made this method call EntityContainer.storeEntity
- renamed ApplicationTxEntityMap to GlobalTxEntityMap
The GlobalTxEntityMap holds all entities for all types contained within a transaction
so that find and remove can synch with the database.
Revision Changes Path
1.50 +10 -47
jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java
Index: EntitySynchronizationInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- EntitySynchronizationInterceptor.java 2001/08/06 16:27:01 1.49
+++ EntitySynchronizationInterceptor.java 2001/08/07 18:06:56 1.50
@@ -57,7 +57,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.49 $
+ * @version $Revision: 1.50 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/06/28: marcf</b>
@@ -92,6 +92,10 @@
* <li>Moved policy to pluggable framework. Work through the interface of the
lock only
* Use of "endTransaction" and "wontSynchronize" to communicate with the lock
* </ol>
+ * <p><b>2001/08/07: billb</b>
+ * <ol>
+ * <li>Moved storeEntity to EntityContainer.
+ * </ol>
*/
public class EntitySynchronizationInterceptor
extends AbstractInterceptor
@@ -118,11 +122,6 @@
protected EntityContainer container;
/**
- * Optional isModified method
- */
- protected Method isModified;
-
- /**
* For commit option D this is the cache of valid entities
*/
protected HashSet validContexts;
@@ -156,9 +155,6 @@
new Thread(vcr).start();
}
- isModified = container.getBeanClass().getMethod("isModified", new
Class[0]);
- if (!isModified.getReturnType().equals(Boolean.TYPE))
- isModified = null; // Has to have "boolean" as return type!
} catch (Exception e)
{
System.out.println(e.getMessage());
@@ -214,27 +210,6 @@
}
}
- private void storeEntity(EntityEnterpriseContext ctx) throws Exception
- {
- if (ctx.getId() != null)
- {
- boolean dirty = true;
- // Check isModified bean method flag
- if (isModified != null)
- {
- Object[] args = {};
- Boolean modified = (Boolean) isModified.invoke(ctx.getInstance(), args);
- dirty = modified.booleanValue();
- }
-
- // Store entity
- if (dirty)
- {
- container.getPersistenceManager().storeEntity(ctx);
- }
- }
- }
-
// Interceptor implementation --------------------------------------
public Object invokeHome(MethodInvocation mi)
@@ -330,7 +305,7 @@
// And skip reads too ("get" methods)
if (ctx.getId() != null)
{
- storeEntity(ctx);
+ container.storeEntity(ctx);
}
return result;
@@ -402,25 +377,13 @@
log.trace("Checking ctx="+ctx+", for status of tx="+tx);
if (tx.getStatus() != Status.STATUS_MARKED_ROLLBACK)
{
- // Check if the bean defines the isModified method
- boolean dirty = true;
- if (isModified != null)
+ try
{
- try
- {
- Object[] args = {};
- Boolean modified = (Boolean)
isModified.invoke(ctx.getInstance(), args);
- dirty = modified.booleanValue();
- }
- catch (Exception ignored)
- {
- }
+ container.storeEntity(ctx);
}
-
+ catch (Exception ignored) {}
if( trace )
- log.trace("sync calling store on ctx "+ctx+",
dirty="+dirty);
- if (dirty)
- container.getPersistenceManager().storeEntity(ctx);
+ log.trace("sync calling store on ctx "+ctx);
}
}
catch (NoSuchEntityException ignored)
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development