[jboss-remoting-commits] JBoss Remoting SVN: r3600 - remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Mar 11 19:54:16 EDT 2008


Author: david.lloyd at jboss.com
Date: 2008-03-11 19:54:16 -0400 (Tue, 11 Mar 2008)
New Revision: 3600

Modified:
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java
Log:
Quiet a generics warning by providing a non-varargs variation of in*()

Modified: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java	2008-03-11 23:46:24 UTC (rev 3599)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java	2008-03-11 23:54:16 UTC (rev 3600)
@@ -488,6 +488,19 @@
         return state;
     }
 
+    public boolean inHoldExclusive(T state) {
+        writeLock.lock();
+        boolean ok = false;
+        try {
+            ok = this.state == state;
+            return ok;
+        } finally {
+            if (! ok) {
+                writeLock.unlock();
+            }
+        }
+    }
+
     public boolean inHoldExclusive(T... states) {
         if (states == null) {
             throw new NullPointerException("states is null");
@@ -502,6 +515,19 @@
         return false;
     }
 
+    public boolean inHold(T state) {
+        readLock.lock();
+        boolean ok = false;
+        try {
+            ok = this.state == state;
+            return ok;
+        } finally {
+            if (! ok) {
+                readLock.unlock();
+            }
+        }
+    }
+
     public boolean inHold(T... states) {
         if (states == null) {
             throw new NullPointerException("states is null");
@@ -516,6 +542,15 @@
         return false;
     }
 
+    public boolean in(T state) {
+        readLock.lock();
+        try {
+            return this.state == state;
+        } finally {
+            readLock.unlock();
+        }
+    }
+
     public boolean in(T... states) {
         if (states == null) {
             throw new NullPointerException("states is null");




More information about the jboss-remoting-commits mailing list