User: starksm
Date: 01/11/20 01:42:52
Modified: src/main/org/jboss/ejb/plugins/lock Tag: Branch_2_4
BeanLockSupport.java MethodOnlyEJBLock.java
QueuedPessimisticEJBLock.java
SimplePessimisticEJBLock.java
Log:
Change to the unified log4j based org.jboss.logging.Logger class.
Revision Changes Path
No revision
No revision
1.4.4.3 +5 -7 jboss/src/main/org/jboss/ejb/plugins/lock/BeanLockSupport.java
Index: BeanLockSupport.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/lock/BeanLockSupport.java,v
retrieving revision 1.4.4.2
retrieving revision 1.4.4.3
diff -u -r1.4.4.2 -r1.4.4.3
--- BeanLockSupport.java 2001/10/20 22:13:22 1.4.4.2
+++ BeanLockSupport.java 2001/11/20 09:42:52 1.4.4.3
@@ -16,16 +16,15 @@
import javax.ejb.EJBObject;
import org.jboss.ejb.BeanLock;
-
import org.jboss.ejb.MethodInvocation;
-import org.jboss.logging.log4j.JBossCategory;
+import org.jboss.logging.Logger;
/**
* Support for the BeanLock
*
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.4.4.2 $
+ * @version $Revision: 1.4.4.3 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/07/29: marcf</b>
@@ -36,6 +35,9 @@
public abstract class BeanLockSupport
implements BeanLock
{
+ /** Use a JBoss custom log4j category for trace level logging */
+ static Logger log = Logger.getLogger(BeanLock.class);
+
/**
* Number of threads invoking methods on this bean
* (1 normally >1 if reentrant)
@@ -53,10 +55,6 @@
/** Are reentrant calls allowed? */
protected boolean reentrant;
-
- /** Use a JBoss custom log4j category for trace level logging */
- static JBossCategory log =
- (JBossCategory) JBossCategory.getInstance(BeanLock.class);
protected Transaction tx = null;
1.1.4.2 +99 -100 jboss/src/main/org/jboss/ejb/plugins/lock/MethodOnlyEJBLock.java
Index: MethodOnlyEJBLock.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/lock/MethodOnlyEJBLock.java,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -r1.1.4.1 -r1.1.4.2
--- MethodOnlyEJBLock.java 2001/09/04 01:50:26 1.1.4.1
+++ MethodOnlyEJBLock.java 2001/11/20 09:42:52 1.1.4.2
@@ -1,100 +1,99 @@
-/*
-* JBoss, the OpenSource EJB server
-*
-* Distributable under LGPL license.
-* See terms of license at gnu.org.
-*/
-
-package org.jboss.ejb.plugins.lock;
-
-import java.util.LinkedList;
-import java.util.HashMap;
-import java.util.Collections;
-import java.lang.reflect.Method;
-
-import javax.transaction.Transaction;
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.TransactionManager;
-import javax.transaction.RollbackException;
-import javax.ejb.EJBObject;
-
-import org.jboss.ejb.MethodInvocation;
-import org.jboss.logging.log4j.JBossCategory;
-
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-
-/**
- * This class does not perform any pessimistic transactional locking. Only locking
- * on single-threaded non-reentrant beans.
- *
- * Holds all locks for entity beans, not used for stateful. <p>
- *
- * All BeanLocks have a reference count.
- * When the reference count goes to 0, the lock is released from the
- * id -> lock mapping.
- *
- * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
- *
- * @version $Revision: 1.1.4.1 $
- *
- * <p><b>Revisions:</b><br>
- * <p><b>2001/08/08: billb</b>
- * <ol>
- * <li>Initial revision
- * </ol>
- */
-public class MethodOnlyEJBLock extends QueuedPessimisticEJBLock
-{
- /**
- * Schedule(MethodInvocation)
- *
- * Schedule implements a particular policy for scheduling the threads coming in.
- * There is always the spec required "serialization" but we can add custom
scheduling in here
- *
- * Synchronizing on lock: a failure to get scheduled must result in a wait()
call and a
- * release of the lock. Schedulation must return with lock.
- *
- */
- public void schedule(MethodInvocation mi)
- throws Exception
- {
- Transaction miTx = mi.getTransaction();
- boolean trace = log.isTraceEnabled();
- this.sync();
- try
- {
- if( trace ) log.trace("Begin schedule, key="+mi.getId());
-
- boolean acquiredMethodLock = false;
- while (!acquiredMethodLock)
- {
- if (isTxExpired(miTx))
- {
- log.error("Saw rolled back tx="+miTx);
- throw new RuntimeException("Transaction marked for rollback,
possibly a timeout");
- }
- acquiredMethodLock = attemptMethodLock(mi, trace);
- }
- }
- finally
- {
- this.releaseSync();
- }
-
- //If we reach here we are properly scheduled to go through
- }
-
- public void endTransaction(Transaction transaction)
- {
- // complete
- }
-
- public void wontSynchronize(Transaction trasaction)
- {
- // complete
- }
-
-}
-
+/*
+* JBoss, the OpenSource EJB server
+*
+* Distributable under LGPL license.
+* See terms of license at gnu.org.
+*/
+
+package org.jboss.ejb.plugins.lock;
+
+import java.util.LinkedList;
+import java.util.HashMap;
+import java.util.Collections;
+import java.lang.reflect.Method;
+
+import javax.transaction.Transaction;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.TransactionManager;
+import javax.transaction.RollbackException;
+import javax.ejb.EJBObject;
+
+import org.jboss.ejb.MethodInvocation;
+
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+
+/**
+ * This class does not perform any pessimistic transactional locking. Only locking
+ * on single-threaded non-reentrant beans.
+ *
+ * Holds all locks for entity beans, not used for stateful. <p>
+ *
+ * All BeanLocks have a reference count.
+ * When the reference count goes to 0, the lock is released from the
+ * id -> lock mapping.
+ *
+ * @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
+ *
+ * @version $Revision: 1.1.4.2 $
+ *
+ * <p><b>Revisions:</b><br>
+ * <p><b>2001/08/08: billb</b>
+ * <ol>
+ * <li>Initial revision
+ * </ol>
+ */
+public class MethodOnlyEJBLock extends QueuedPessimisticEJBLock
+{
+ /**
+ * Schedule(MethodInvocation)
+ *
+ * Schedule implements a particular policy for scheduling the threads coming in.
+ * There is always the spec required "serialization" but we can add custom
scheduling in here
+ *
+ * Synchronizing on lock: a failure to get scheduled must result in a wait()
call and a
+ * release of the lock. Schedulation must return with lock.
+ *
+ */
+ public void schedule(MethodInvocation mi)
+ throws Exception
+ {
+ Transaction miTx = mi.getTransaction();
+ boolean trace = log.isTraceEnabled();
+ this.sync();
+ try
+ {
+ if( trace ) log.trace("Begin schedule, key="+mi.getId());
+
+ boolean acquiredMethodLock = false;
+ while (!acquiredMethodLock)
+ {
+ if (isTxExpired(miTx))
+ {
+ log.error("Saw rolled back tx="+miTx);
+ throw new RuntimeException("Transaction marked for rollback,
possibly a timeout");
+ }
+ acquiredMethodLock = attemptMethodLock(mi, trace);
+ }
+ }
+ finally
+ {
+ this.releaseSync();
+ }
+
+ //If we reach here we are properly scheduled to go through
+ }
+
+ public void endTransaction(Transaction transaction)
+ {
+ // complete
+ }
+
+ public void wontSynchronize(Transaction trasaction)
+ {
+ // complete
+ }
+
+}
+
1.3.4.3 +1 -4
jboss/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java
Index: QueuedPessimisticEJBLock.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/lock/QueuedPessimisticEJBLock.java,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -u -r1.3.4.2 -r1.3.4.3
--- QueuedPessimisticEJBLock.java 2001/10/20 22:13:22 1.3.4.2
+++ QueuedPessimisticEJBLock.java 2001/11/20 09:42:52 1.3.4.3
@@ -17,10 +17,7 @@
import javax.transaction.Transaction;
import org.jboss.ejb.MethodInvocation;
-import org.jboss.logging.log4j.JBossCategory;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
/**
* This class is holds threads awaiting the transactional lock to be free
@@ -39,7 +36,7 @@
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
*
- * @version $Revision: 1.3.4.2 $
+ * @version $Revision: 1.3.4.3 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/08/03: billb</b>
1.5.4.3 +1 -2
jboss/src/main/org/jboss/ejb/plugins/lock/SimplePessimisticEJBLock.java
Index: SimplePessimisticEJBLock.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/lock/SimplePessimisticEJBLock.java,v
retrieving revision 1.5.4.2
retrieving revision 1.5.4.3
diff -u -r1.5.4.2 -r1.5.4.3
--- SimplePessimisticEJBLock.java 2001/10/20 22:13:22 1.5.4.2
+++ SimplePessimisticEJBLock.java 2001/11/20 09:42:52 1.5.4.3
@@ -17,7 +17,6 @@
import javax.ejb.EJBObject;
import org.jboss.ejb.MethodInvocation;
-import org.jboss.logging.log4j.JBossCategory;
/**
* Holds all locks for entity beans, not used for stateful.
@@ -28,7 +27,7 @@
*
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.5.4.2 $
+ * @version $Revision: 1.5.4.3 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/07/29: billb</b>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development