[jboss-cvs] JBossAS SVN: r102151 - projects/ejb3/components/concurrency/trunk/api/src/main/java/org/jboss/ejb3/concurrency/api.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 9 13:04:10 EST 2010
Author: jaikiran
Date: 2010-03-09 13:04:09 -0500 (Tue, 09 Mar 2010)
New Revision: 102151
Modified:
projects/ejb3/components/concurrency/trunk/api/src/main/java/org/jboss/ejb3/concurrency/api/EJBReadWriteLock.java
Log:
Added javadoc
Modified: projects/ejb3/components/concurrency/trunk/api/src/main/java/org/jboss/ejb3/concurrency/api/EJBReadWriteLock.java
===================================================================
--- projects/ejb3/components/concurrency/trunk/api/src/main/java/org/jboss/ejb3/concurrency/api/EJBReadWriteLock.java 2010-03-09 17:52:24 UTC (rev 102150)
+++ projects/ejb3/components/concurrency/trunk/api/src/main/java/org/jboss/ejb3/concurrency/api/EJBReadWriteLock.java 2010-03-09 18:04:09 UTC (rev 102151)
@@ -40,13 +40,28 @@
{
private static final long serialVersionUID = 1L;
+ /**
+ * Holds the count of read locks possessed by the thread
+ */
private ThreadLocal<Integer> readLockCount = new ThreadLocal<Integer>();
+ /**
+ * The lock API calls will be delegated to this {@link ReentrantReadWriteLock}
+ */
private ReentrantReadWriteLock delegate = new ReentrantReadWriteLock();
private Lock readLock = new ReadLock();
private Lock writeLock = new WriteLock();
+ /**
+ *
+ * Delegates all it's calls to a {@link ReentrantReadWriteLock} and at
+ * the same time, keeps count of number of read locks the current thread has
+ * acquired
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
public class ReadLock implements Lock, Serializable
{
private static final long serialVersionUID = 1L;
@@ -102,6 +117,17 @@
}
+ /**
+ *
+ * An implementation of {@link Lock} which while obtaining a lock,
+ * first checks whether the current thread holds a read lock. If yes,
+ * then this implementation throws a {@link IllegalLoopbackException}
+ * as defined by the EJB3.1 spec (i.e. not allowed to upgrade to write
+ * lock when holding a read lock)
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
public class WriteLock implements Lock, Serializable
{
private static final long serialVersionUID = 1L;
@@ -147,6 +173,10 @@
}
}
+ /**
+ * Check whether the current thread holds a read lock. If yes, then throws
+ * {@link IllegalLoopbackException}
+ */
private void checkLoopback()
{
Integer current = readLockCount.get();
More information about the jboss-cvs-commits
mailing list