[jboss-cvs] JBossCache/src/org/jboss/cache/lock ...
Manik Surtani
msurtani at jboss.com
Mon Aug 14 13:52:34 EDT 2006
User: msurtani
Date: 06/08/14 13:52:34
Modified: src/org/jboss/cache/lock IsolationLevel.java LockUtil.java
Log:
Converted NodeLockingScheme, IsolationLevel and LockType to enums
Revision Changes Path
1.6 +4 -39 JBossCache/src/org/jboss/cache/lock/IsolationLevel.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: IsolationLevel.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/lock/IsolationLevel.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- IsolationLevel.java 31 May 2006 14:08:39 -0000 1.5
+++ IsolationLevel.java 14 Aug 2006 17:52:34 -0000 1.6
@@ -1,49 +1,14 @@
/**
*
* @author Bela Ban Nov 25, 2003
- * @version $Id: IsolationLevel.java,v 1.5 2006/05/31 14:08:39 msurtani Exp $
+ * @version $Id: IsolationLevel.java,v 1.6 2006/08/14 17:52:34 msurtani Exp $
*/
package org.jboss.cache.lock;
/**
* Various transaction isolation levels as an enumerated class.
*/
-public class IsolationLevel
+public enum IsolationLevel
{
- public static final IsolationLevel NONE = new IsolationLevel("NONE");
- public static final IsolationLevel SERIALIZABLE = new IsolationLevel("SERIALIZABLE");
- public static final IsolationLevel REPEATABLE_READ = new IsolationLevel("REPEATABLE_READ");
- public static final IsolationLevel READ_COMMITTED = new IsolationLevel("READ_COMMITTED");
- public static final IsolationLevel READ_UNCOMMITTED = new IsolationLevel("READ_UNCOMMITTED");
-
- private final String myName; // for debug only
-
- private IsolationLevel(String name)
- {
- myName = name;
- }
-
- /**
- * Returns the level as a string.
- */
- public String toString()
- {
- return myName;
- }
-
- /**
- * Returns an isolation level from a string.
- * Returns null if not found.
- */
- public static IsolationLevel stringToIsolationLevel(String level)
- {
- if (level == null) return null;
- level = level.toLowerCase().trim();
- if (level.equals("none")) return NONE;
- if (level.equals("serializable")) return SERIALIZABLE;
- if (level.equals("repeatable_read") || level.equals("repeatable-read")) return REPEATABLE_READ;
- if (level.equals("read_committed") || level.equals("read-committed")) return READ_COMMITTED;
- if (level.equals("read_uncommitted") || level.equals("read-uncommitted")) return READ_UNCOMMITTED;
- return null;
- }
+ NONE, SERIALIZABLE, REPEATABLE_READ, READ_COMMITTED, READ_UNCOMMITTED
}
1.2 +2 -2 JBossCache/src/org/jboss/cache/lock/LockUtil.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LockUtil.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/lock/LockUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- LockUtil.java 20 Jul 2006 21:58:22 -0000 1.1
+++ LockUtil.java 14 Aug 2006 17:52:34 -0000 1.2
@@ -124,7 +124,7 @@
// Seems no one is holding a lock and it's there for the taking.
try
{
- acquired = node.acquire(newOwner, 1, DataNode.LOCK_TYPE_READ);
+ acquired = node.acquire(newOwner, 1, DataNode.LockType.READ);
}
catch (Exception ignored)
{
@@ -195,7 +195,7 @@
try
{
- acquired = node.acquire(newOwner, 1, DataNode.LOCK_TYPE_READ);
+ acquired = node.acquire(newOwner, 1, DataNode.LockType.READ);
}
catch (Exception ignore)
{
More information about the jboss-cvs-commits
mailing list