User: starksm
Date: 01/10/21 09:17:07
Modified: src/main/org/jboss/ejb Tag: Branch_2_4 BeanLockManager.java
Log:
Change org.jboss.tm.TxManager to javax.transaction.TransactionManager in
TxInterceptorBMT and remove all imports of TxManager.
Revision Changes Path
No revision
No revision
1.5.4.2 +89 -90 jboss/src/main/org/jboss/ejb/BeanLockManager.java
Index: BeanLockManager.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/BeanLockManager.java,v
retrieving revision 1.5.4.1
retrieving revision 1.5.4.2
diff -u -r1.5.4.1 -r1.5.4.2
--- BeanLockManager.java 2001/09/04 01:51:49 1.5.4.1
+++ BeanLockManager.java 2001/10/21 16:17:07 1.5.4.2
@@ -1,90 +1,89 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
-*/
-
-package org.jboss.ejb;
-
-import java.util.HashMap;
-
-import org.jboss.metadata.EntityMetaData;
-import org.jboss.ejb.Container;
-import org.jboss.tm.TxManager;
-
-/**
- * Manages BeanLocks. 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>
- * @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
- *
- * @version $Revision: 1.5.4.1 $
- * <p><b>Revisions:</b><br>
- * <p><b>20010802: marcf</b>
- * <ol>
- * <li>Made bean lock pluggable, container factory passes in lockClass
- * <li>Removed un-used constructor, added getters and setters
- * </ol>
- */
-public class BeanLockManager
-{
- private HashMap map = new HashMap();
-
- /** The container this manager reports to */
- private Container container;
-
- /** Reentrancy of calls */
- private boolean reentrant = false;
- private int txTimeout = 5000;
-
- public Class lockClass;
-
- /**
- * returns the lock associated with the key passed. If there is
- * no lock one is created this call also increments the number of
- * references interested in Lock.
- *
- * WARNING: All access to this method MUST have an equivalent
- * removeLockRef cleanup call, or this will create a leak in the map,
- */
- public synchronized BeanLock getLock(Object id)
- {
- BeanLock lock = (BeanLock)map.get(id);
- if (lock == null)
- {
- try {
- lock = (BeanLock) lockClass.newInstance();
-
- lock.setId(id);
- lock.setReentrant(reentrant);
- lock.setTimeout(txTimeout);
- }
- catch (Exception e ) {e.printStackTrace();}
-
- map.put(id, lock);
- }
- lock.addRef();
-
- return lock;
- }
-
- public synchronized void removeLockRef(Object id)
- {
- BeanLock lock = (BeanLock)map.get(id);
- if (lock != null)
- {
- lock.removeRef();
- if (lock.getRefs() <= 0)
- {
- map.remove(lock.getId());
- }
- }
- }
-
- public void setLockCLass(Class lockClass) {this.lockClass=lockClass;}
- public void setReentrant(boolean reentrant) {this.reentrant = reentrant;}
-}
-
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+*/
+
+package org.jboss.ejb;
+
+import java.util.HashMap;
+
+import org.jboss.metadata.EntityMetaData;
+import org.jboss.ejb.Container;
+
+/**
+ * Manages BeanLocks. 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>
+ * @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
+ *
+ * @version $Revision: 1.5.4.2 $
+ * <p><b>Revisions:</b><br>
+ * <p><b>20010802: marcf</b>
+ * <ol>
+ * <li>Made bean lock pluggable, container factory passes in lockClass
+ * <li>Removed un-used constructor, added getters and setters
+ * </ol>
+ */
+public class BeanLockManager
+{
+ private HashMap map = new HashMap();
+
+ /** The container this manager reports to */
+ private Container container;
+
+ /** Reentrancy of calls */
+ private boolean reentrant = false;
+ private int txTimeout = 5000;
+
+ public Class lockClass;
+
+ /**
+ * returns the lock associated with the key passed. If there is
+ * no lock one is created this call also increments the number of
+ * references interested in Lock.
+ *
+ * WARNING: All access to this method MUST have an equivalent
+ * removeLockRef cleanup call, or this will create a leak in the map,
+ */
+ public synchronized BeanLock getLock(Object id)
+ {
+ BeanLock lock = (BeanLock)map.get(id);
+ if (lock == null)
+ {
+ try {
+ lock = (BeanLock) lockClass.newInstance();
+
+ lock.setId(id);
+ lock.setReentrant(reentrant);
+ lock.setTimeout(txTimeout);
+ }
+ catch (Exception e ) {e.printStackTrace();}
+
+ map.put(id, lock);
+ }
+ lock.addRef();
+
+ return lock;
+ }
+
+ public synchronized void removeLockRef(Object id)
+ {
+ BeanLock lock = (BeanLock)map.get(id);
+ if (lock != null)
+ {
+ lock.removeRef();
+ if (lock.getRefs() <= 0)
+ {
+ map.remove(lock.getId());
+ }
+ }
+ }
+
+ public void setLockCLass(Class lockClass) {this.lockClass=lockClass;}
+ public void setReentrant(boolean reentrant) {this.reentrant = reentrant;}
+}
+
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development