User: patriot1burke
Date: 01/10/18 13:46:30
Modified: src/main/org/jboss/ejb/plugins
EntitySynchronizationInterceptor.java
EntityInstanceInterceptor.java
Log:
code was incorrectly locking bean and inserting bean in invokeHome even if there
was an exception thrown. This is wrong.
Revision Changes Path
1.55 +24 -24
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.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- EntitySynchronizationInterceptor.java 2001/10/11 16:34:45 1.54
+++ EntitySynchronizationInterceptor.java 2001/10/18 20:46:29 1.55
@@ -56,7 +56,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.54 $
+ * @version $Revision: 1.55 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/06/28: marcf</b>
@@ -102,6 +102,10 @@
* <ol>
* <li>Do not cache.release a removed entity or removed entity can be put back
into cache
* </ol>
+ * <p><b>2001/10/18: billb</b>
+ * <ol>
+ * <li>Do not lock bean on an exception
+ * </ol>
*/
public class EntitySynchronizationInterceptor
extends AbstractInterceptor
@@ -227,35 +231,31 @@
EntityEnterpriseContext ctx =
(EntityEnterpriseContext)mi.getEnterpriseContext();
Transaction tx = mi.getTransaction();
- try
- {
- return getNext().invokeHome(mi);
- } finally
- {
+ Object rtn = getNext().invokeHome(mi);
- // An anonymous context was sent in, so if it has an id it is a real
instance now
- if (ctx.getId() != null)
+ // An anonymous context was sent in, so if it has an id it is a real instance
now
+ if (ctx.getId() != null)
+ {
+
+ // Currently synched with underlying storage
+ ctx.setValid(true);
+
+ if (tx!= null)
{
-
- // Currently synched with underlying storage
- ctx.setValid(true);
-
- if (tx!= null)
+ BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey());
+ try
+ {
+ lock.schedule(mi);
+ register(ctx, tx); // Set tx
+ lock.releaseMethodLock();
+ }
+ finally
{
- BeanLock lock =
container.getLockManager().getLock(ctx.getCacheKey());
- try
- {
- lock.schedule(mi);
- register(ctx, tx); // Set tx
- lock.releaseMethodLock();
- }
- finally
- {
- container.getLockManager().removeLockRef(lock.getId());
- }
+ container.getLockManager().removeLockRef(lock.getId());
}
}
}
+ return rtn;
}
public Object invoke(MethodInvocation mi)
1.45 +26 -28
jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
Index: EntityInstanceInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- EntityInstanceInterceptor.java 2001/09/11 18:34:59 1.44
+++ EntityInstanceInterceptor.java 2001/10/18 20:46:29 1.45
@@ -60,7 +60,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.44 $
+* @version $Revision: 1.45 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/06/28: marcf</b>
@@ -104,6 +104,10 @@
* <li> For the record, locking went from cache (early 2.0) -> this interceptor ->
new interceptor
* <li> new locking is pluggable
* </ol>
+* <p><b>2001/10/18: billb</b>
+* <ol>
+* <li>Do not insert bean into cache on an exception
+* </ol>
*/
public class EntityInstanceInterceptor
extends AbstractInterceptor
@@ -143,37 +147,31 @@
// Give it the transaction
ctx.setTransaction(mi.getTransaction());
- try
- {
// Invoke through interceptors
- return getNext().invokeHome(mi);
- }
- finally
- {
-
- // Is the context now with an identity? in which case we need to insert
- if (ctx.getId() != null)
+ Object rtn = getNext().invokeHome(mi);
+ // Is the context now with an identity? in which case we need to insert
+ if (ctx.getId() != null)
+ {
+
+ BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey());
+
+ lock.sync(); // lock all access to BeanLock
+
+ try
+ {
+ // marcf: possible race on creation and usage
+ // insert instance in cache,
+ container.getInstanceCache().insert(ctx);
+
+ }
+ finally
{
-
- BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey());
-
- lock.sync(); // lock all access to BeanLock
-
- try
- {
- // marcf: possible race on creation and usage
- // insert instance in cache,
- container.getInstanceCache().insert(ctx);
-
- }
- finally
- {
- lock.releaseSync();
- container.getLockManager().removeLockRef(ctx.getCacheKey());
- }
+ lock.releaseSync();
+ container.getLockManager().removeLockRef(ctx.getCacheKey());
}
- //Do not send back to pools in any case, let the instance be GC'ed
}
+ //Do not send back to pools in any case, let the instance be GC'ed
+ return rtn;
}
public Object invoke(MethodInvocation mi)
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development