User: patriot1burke
Date: 01/08/08 15:00:46
Modified: src/main/org/jboss/ejb/plugins
EntitySynchronizationInterceptor.java
EntityLockInterceptor.java
EntityInstanceInterceptor.java
Log:
refactored BeanLock interface
added scheduling to invokeHome.
Revision Changes Path
1.51 +16 -2
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.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- EntitySynchronizationInterceptor.java 2001/08/07 18:06:56 1.50
+++ EntitySynchronizationInterceptor.java 2001/08/08 22:00:46 1.51
@@ -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.50 $
+ * @version $Revision: 1.51 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/06/28: marcf</b>
@@ -95,6 +95,7 @@
* <p><b>2001/08/07: billb</b>
* <ol>
* <li>Moved storeEntity to EntityContainer.
+ * <li>invokeHome is now scheduled
* </ol>
*/
public class EntitySynchronizationInterceptor
@@ -232,7 +233,20 @@
// Currently synched with underlying storage
ctx.setValid(true);
- if (tx!= null) register(ctx, tx); // Set tx
+ if (tx!= null)
+ {
+ BeanLock lock =
container.getLockManager().getLock(ctx.getCacheKey());
+ try
+ {
+ lock.schedule(mi);
+ register(ctx, tx); // Set tx
+ lock.releaseMethodLock();
+ }
+ finally
+ {
+ container.getLockManager().removeLockRef(lock.getId());
+ }
+ }
}
}
}
1.5 +6 -16 jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java
Index: EntityLockInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EntityLockInterceptor.java 2001/08/03 20:11:26 1.4
+++ EntityLockInterceptor.java 2001/08/08 22:00:46 1.5
@@ -56,7 +56,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
-* @version $Revision: 1.4 $
+* @version $Revision: 1.5 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/07/30: marcf</b>
@@ -65,6 +65,10 @@
* <li>Factorization of the lock out of the context in cache
* <li>The new locking is implement as "scheduling" in the lock which allows for
pluggable locks
* </ol>
+* <p><b>2001/08/07: billb</b>
+* <ol>
+* <li>Removed while loop and moved it to SimplePessimisticEJBLock where it
belongs.
+* </ol>
*/
public class EntityLockInterceptor
extends AbstractInterceptor
@@ -125,21 +129,7 @@
{
lock = (BeanLock)container.getLockManager().getLock(key);
- while (!threadIsScheduled)
- {
- if( trace ) log.trace("new while(threadNotScheduled) for key"+key);
-
-
- /**
- * schedule will implement the actual lock policy in the lock
- * we provide a default "pessimistic lock" on the transaction
- * as well as the default serialization required by the specification
- * the method releases the sync if the thread isn't scheduled and goes
to wait
- * upon waking up it must go through the schedule again
- * Also schedule must add a methodLock
- */
- threadIsScheduled = lock.schedule(mi);
- }
+ lock.schedule(mi);
try {
1.43 +5 -8
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.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- EntityInstanceInterceptor.java 2001/08/07 18:34:11 1.42
+++ EntityInstanceInterceptor.java 2001/08/08 22:00:46 1.43
@@ -61,7 +61,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.42 $
+* @version $Revision: 1.43 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/06/28: marcf</b>
@@ -164,11 +164,8 @@
lock.sync(); // lock all access to BeanLock
- try {
-
- // Set the transaction on the lock it will protect the instance
- lock.setTransaction(ctx.getTransaction());
-
+ try
+ {
// marcf: possible race on creation and usage
// insert instance in cache,
container.getInstanceCache().insert(ctx);
@@ -177,7 +174,6 @@
finally
{
lock.releaseSync();
-
container.getLockManager().removeLockRef(ctx.getCacheKey());
}
}
@@ -215,7 +211,8 @@
{
exceptionThrown = true;
throw e;
- } catch (RuntimeException e)
+ }
+ catch (RuntimeException e)
{
exceptionThrown = true;
throw e;
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development