[jboss-svn-commits] JBL Code SVN: r31779 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Feb 22 19:19:29 EST 2010
Author: mark.little at jboss.com
Date: 2010-02-22 19:19:27 -0500 (Mon, 22 Feb 2010)
New Revision: 31779
Added:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/BasicMutex.java
Removed:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Mutex.java
labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/semaphore/BasicSemaphore.java
labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/semaphore/Semaphore.java
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java
labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/MutexUnitTest.java
labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/LockManager.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/FactoryList.java
Log:
https://jira.jboss.org/jira/browse/JBTM-709
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java 2010-02-22 18:34:40 UTC (rev 31778)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/StateManager.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -54,6 +54,7 @@
import com.arjuna.ats.internal.arjuna.abstractrecords.DisposeRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord;
import com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord;
+import com.arjuna.ats.internal.arjuna.common.BasicMutex;
import com.arjuna.ats.internal.arjuna.common.UidHelper;
import java.io.IOException;
@@ -1492,7 +1493,7 @@
* @since JTS 2.1.
*/
- protected final Mutex getMutex ()
+ protected final BasicMutex getMutex ()
{
return mutex;
}
@@ -1504,7 +1505,7 @@
protected final boolean lockMutex ()
{
- if (mutex.lock() == Mutex.LOCKED)
+ if (mutex.lock() == BasicMutex.LOCKED)
return true;
else
return false;
@@ -1517,7 +1518,7 @@
protected final boolean unlockMutex ()
{
- if (mutex.unlock() == Mutex.UNLOCKED)
+ if (mutex.unlock() == BasicMutex.UNLOCKED)
return true;
else
return false;
@@ -1531,7 +1532,7 @@
protected final boolean tryLockMutex ()
{
- if (mutex.tryLock() == Mutex.LOCKED)
+ if (mutex.tryLock() == BasicMutex.LOCKED)
return true;
else
return false;
@@ -1573,7 +1574,7 @@
private String storeRoot;
- private Mutex mutex = new Mutex();
+ private BasicMutex mutex = new BasicMutex();
private static final String marker = "#ARJUNA#";
}
Deleted: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Mutex.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Mutex.java 2010-02-22 18:34:40 UTC (rev 31778)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/Mutex.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -1,229 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 2001,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: Mutex.java 2342 2006-03-30 13:06:17Z $
- */
-
-package com.arjuna.ats.arjuna.common;
-
-import java.lang.InterruptedException;
-
-import com.arjuna.ats.arjuna.logging.tsLogger;
-import com.arjuna.ats.arjuna.logging.FacilityCode;
-
-import com.arjuna.common.util.logging.*;
-
-/**
- * This is a reentrant Mutex implementation.
- *
- * @author Mark Little (mark at arjuna.com)
- * @version $Id: Mutex.java 2342 2006-03-30 13:06:17Z $
- * @since 1.0.
- *
- * @message com.arjuna.ats.arjuna.common.Mutex_1 [com.arjuna.ats.arjuna.common.Mutex_1] - Mutex being destroyed with waiters.
- * @message com.arjuna.ats.arjuna.common.Mutex_2 [com.arjuna.ats.arjuna.common.Mutex_2] - Mutex.unlock - called by non-owning thread!
- *
- */
-
-public class Mutex
-{
-
- public static final int LOCKED = 0;
- public static final int UNLOCKED = 1;
- public static final int WOULD_BLOCK = 2;
- public static final int ERROR = 3;
-
- public Mutex ()
- {
- // this(true);
- this(false);
- }
-
- public Mutex (boolean reentrant)
- {
- _lock = new Object();
- _users = 0;
- _owner = null;
- _reentrant = reentrant;
- _recursiveCalls = 0;
- }
-
- /**
- * Classic mutex operations.
- */
-
- public int lock ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_GENERAL, "Mutex::lock()");
- }
-
- synchronized (_lock)
- {
- if (_users == 0)
- {
- _users = 1;
-
- if (_reentrant)
- {
- _owner = Thread.currentThread();
- _recursiveCalls = 1;
- }
- }
- else
- {
- boolean done = false;
-
- if (_reentrant)
- {
- if (_owner == Thread.currentThread())
- {
- _recursiveCalls++;
-
- done = true;
- }
- }
-
- if (!done)
- {
- _users++;
-
- try
- {
- _lock.wait();
- }
- catch (InterruptedException e)
- {
- }
- }
- }
- }
-
- return Mutex.LOCKED;
- }
-
- public int unlock ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_GENERAL, "Mutex::unlock()");
- }
-
- synchronized (_lock)
- {
- if (_users <= 0)
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.common.Mutex_2");
- }
-
- return Mutex.ERROR;
- }
- else
- {
- boolean done = false;
-
- if (_reentrant)
- {
- if (_owner == Thread.currentThread())
- {
- if (--_recursiveCalls == 0)
- _owner = null;
-
- done = true;
- }
- else
- {
- if (tsLogger.arjLoggerI18N.isWarnEnabled())
- {
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.common.Mutex_2");
- }
-
- return Mutex.LOCKED;
- }
- }
-
- if (!done)
- {
- if (--_users >= 0)
- {
- _lock.notify();
- }
- }
- }
- }
-
- return Mutex.UNLOCKED;
- }
-
- public int tryLock ()
- {
- if (tsLogger.arjLogger.isDebugEnabled())
- {
- tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_GENERAL, "Mutex::tryLock()");
- }
-
- synchronized (_lock)
- {
- if (_users == 0)
- return lock();
- else
- {
- if (_reentrant)
- {
- if (_owner == Thread.currentThread())
- return lock();
- }
-
- return Mutex.WOULD_BLOCK;
- }
- }
- }
-
- private Object _lock;
- private int _users;
- private Thread _owner;
- private boolean _reentrant;
- private int _recursiveCalls;
-
-}
-
-
-
-
-
-
-
-
-
Added: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/BasicMutex.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/BasicMutex.java (rev 0)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/BasicMutex.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -0,0 +1,224 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2001,
+ *
+ * Arjuna Solutions Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: Mutex.java 2342 2006-03-30 13:06:17Z $
+ */
+
+package com.arjuna.ats.internal.arjuna.common;
+
+import java.lang.InterruptedException;
+
+import com.arjuna.ats.arjuna.common.Mutex;
+import com.arjuna.ats.arjuna.logging.tsLogger;
+import com.arjuna.ats.arjuna.logging.FacilityCode;
+
+import com.arjuna.common.util.logging.*;
+
+/**
+ * This is a reentrant Mutex implementation.
+ *
+ * @author Mark Little (mark at arjuna.com)
+ * @version $Id: Mutex.java 2342 2006-03-30 13:06:17Z $
+ * @since 1.0.
+ *
+ * @message com.arjuna.ats.arjuna.common.Mutex_1 [com.arjuna.ats.arjuna.common.Mutex_1] - Mutex being destroyed with waiters.
+ * @message com.arjuna.ats.arjuna.common.Mutex_2 [com.arjuna.ats.arjuna.common.Mutex_2] - Mutex.unlock - called by non-owning thread!
+ *
+ */
+
+public class BasicMutex implements Mutex
+{
+ public BasicMutex ()
+ {
+ // this(true);
+ this(false);
+ }
+
+ public BasicMutex (boolean reentrant)
+ {
+ _lock = new Object();
+ _users = 0;
+ _owner = null;
+ _reentrant = reentrant;
+ _recursiveCalls = 0;
+ }
+
+ /**
+ * Classic mutex operations.
+ */
+
+ public int lock ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_GENERAL, "Mutex::lock()");
+ }
+
+ synchronized (_lock)
+ {
+ if (_users == 0)
+ {
+ _users = 1;
+
+ if (_reentrant)
+ {
+ _owner = Thread.currentThread();
+ _recursiveCalls = 1;
+ }
+ }
+ else
+ {
+ boolean done = false;
+
+ if (_reentrant)
+ {
+ if (_owner == Thread.currentThread())
+ {
+ _recursiveCalls++;
+
+ done = true;
+ }
+ }
+
+ if (!done)
+ {
+ _users++;
+
+ try
+ {
+ _lock.wait();
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+ }
+ }
+
+ return BasicMutex.LOCKED;
+ }
+
+ public int unlock ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_GENERAL, "Mutex::unlock()");
+ }
+
+ synchronized (_lock)
+ {
+ if (_users <= 0)
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.common.Mutex_2");
+ }
+
+ return BasicMutex.ERROR;
+ }
+ else
+ {
+ boolean done = false;
+
+ if (_reentrant)
+ {
+ if (_owner == Thread.currentThread())
+ {
+ if (--_recursiveCalls == 0)
+ _owner = null;
+
+ done = true;
+ }
+ else
+ {
+ if (tsLogger.arjLoggerI18N.isWarnEnabled())
+ {
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.common.Mutex_2");
+ }
+
+ return BasicMutex.LOCKED;
+ }
+ }
+
+ if (!done)
+ {
+ if (--_users >= 0)
+ {
+ _lock.notify();
+ }
+ }
+ }
+ }
+
+ return BasicMutex.UNLOCKED;
+ }
+
+ public int tryLock ()
+ {
+ if (tsLogger.arjLogger.isDebugEnabled())
+ {
+ tsLogger.arjLogger.debug(DebugLevel.FUNCTIONS,
+ VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_GENERAL, "Mutex::tryLock()");
+ }
+
+ synchronized (_lock)
+ {
+ if (_users == 0)
+ return lock();
+ else
+ {
+ if (_reentrant)
+ {
+ if (_owner == Thread.currentThread())
+ return lock();
+ }
+
+ return BasicMutex.WOULD_BLOCK;
+ }
+ }
+ }
+
+ private Object _lock;
+ private int _users;
+ private Thread _owner;
+ private boolean _reentrant;
+ private int _recursiveCalls;
+
+}
+
+
+
+
+
+
+
+
+
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/MutexUnitTest.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/MutexUnitTest.java 2010-02-22 18:34:40 UTC (rev 31778)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/tests/classes/com/hp/mwtests/ts/arjuna/common/MutexUnitTest.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -22,20 +22,20 @@
import org.junit.Test;
-import com.arjuna.ats.arjuna.common.Mutex;
+import com.arjuna.ats.internal.arjuna.common.BasicMutex;
import static org.junit.Assert.*;
class MutexThread extends Thread
{
- public MutexThread (Mutex share)
+ public MutexThread (BasicMutex share)
{
_mutex = share;
}
public void run ()
{
- if (_mutex.lock() == Mutex.LOCKED)
+ if (_mutex.lock() == BasicMutex.LOCKED)
{
for (int i = 0; i < 1000; i++)
{
@@ -55,7 +55,7 @@
return _done;
}
- private Mutex _mutex;
+ private BasicMutex _mutex;
private boolean _done = false;
}
@@ -64,7 +64,7 @@
@Test
public void testBasicMutex () throws Exception
{
- Mutex mx = new Mutex();
+ BasicMutex mx = new BasicMutex();
mx.lock();
@@ -74,7 +74,7 @@
@Test
public void testThreaded () throws Exception
{
- Mutex mx = new Mutex();
+ BasicMutex mx = new BasicMutex();
MutexThread mt1 = new MutexThread(mx);
MutexThread mt2 = new MutexThread(mx);
@@ -98,27 +98,27 @@
@Test
public void testInvalid () throws Exception
{
- Mutex mx = new Mutex();
+ BasicMutex mx = new BasicMutex();
- assertEquals(mx.unlock(), Mutex.ERROR);
+ assertEquals(mx.unlock(), BasicMutex.ERROR);
}
@Test
public void testReentrantMutex () throws Exception
{
- Mutex mx = new Mutex();
+ BasicMutex mx = new BasicMutex();
mx.lock();
- assertEquals(mx.tryLock(), Mutex.WOULD_BLOCK);
+ assertEquals(mx.tryLock(), BasicMutex.WOULD_BLOCK);
mx.unlock();
- mx = new Mutex(true);
+ mx = new BasicMutex(true);
mx.lock();
- assertEquals(mx.tryLock(), Mutex.LOCKED);
+ assertEquals(mx.tryLock(), BasicMutex.LOCKED);
mx.unlock();
mx.unlock();
Deleted: labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/semaphore/BasicSemaphore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/semaphore/BasicSemaphore.java 2010-02-22 18:34:40 UTC (rev 31778)
+++ labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/internal/txoj/semaphore/BasicSemaphore.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -1,203 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: BasicSemaphore.java 2342 2006-03-30 13:06:17Z $
- */
-
-package com.arjuna.ats.internal.txoj.semaphore;
-
-import com.arjuna.ats.txoj.semaphore.*;
-
-import com.arjuna.ats.txoj.logging.txojLogger;
-
-import com.arjuna.common.util.logging.*;
-
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.HashMap;
-
-import java.lang.InterruptedException;
-
-/**
- * Actually a mutex at present since we assume resource count of 1.
- */
-
-public class BasicSemaphore extends Semaphore
-{
-
- public BasicSemaphore(String key)
- {
- owner = null;
- useCount = 0;
- waiters = new Hashtable();
- numberOfResources = 1;
- semKey = key;
-
- if (txojLogger.aitLogger.isDebugEnabled())
- {
- txojLogger.aitLogger.debug(DebugLevel.CONSTRUCTORS,
- VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_GENERAL,
- "BasicSemapore::BasicSemaphore ( " + key + " )");
- }
- }
-
- /**
- * @message com.arjuna.ats.internal.txoj.semaphore.BasicSemaphore_1
- * [com.arjuna.ats.internal.txoj.semaphore.BasicSemaphore_1] -
- * BasicSemaphore being destroyed with waiters.
- */
- public void finalize ()
- {
- if (waiters.size() != 0)
- {
- if (txojLogger.aitLoggerI18N.isWarnEnabled())
- {
- txojLogger.aitLoggerI18N
- .warn("com.arjuna.ats.internal.txoj.semaphore.BasicSemaphore_1");
- }
- }
-
- owner = null;
- waiters = null;
- }
-
- /**
- * Classic semaphore operations.
- */
-
- public int lock ()
- {
- if (txojLogger.aitLogger.isDebugEnabled())
- {
- txojLogger.aitLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_GENERAL,
- "BasicSemapore::lock()");
- }
-
- synchronized (this)
- {
- Thread t = Thread.currentThread();
-
- if (owner == null)
- owner = t;
- else
- {
- if (owner != t)
- {
- waiters.put(t, t);
-
- while (owner != null)
- {
- try
- {
- this.wait();
- }
- catch (InterruptedException e)
- {
- }
- }
-
- waiters.remove(t);
-
- owner = t;
- }
- }
-
- useCount++;
- }
-
- return Semaphore.SM_LOCKED;
- }
-
- public int unlock ()
- {
- if (txojLogger.aitLogger.isDebugEnabled())
- {
- txojLogger.aitLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_GENERAL,
- "BasicSemapore::unlock()");
- }
-
- synchronized (this)
- {
- Thread t = Thread.currentThread();
-
- if (owner != t)
- return Semaphore.SM_ERROR;
- else
- {
- if (--useCount == 0)
- {
- owner = null;
-
- if (waiters.size() > 0)
- {
- this.notify();
- }
- }
- }
- }
-
- return Semaphore.SM_UNLOCKED;
- }
-
- public int tryLock ()
- {
- if (txojLogger.aitLogger.isDebugEnabled())
- {
- txojLogger.aitLogger.debug(DebugLevel.FUNCTIONS,
- VisibilityLevel.VIS_PUBLIC,
- com.arjuna.ats.arjuna.logging.FacilityCode.FAC_GENERAL,
- "BasicSemapore::tryLock()");
- }
-
- synchronized (this)
- {
- if ((owner == null) || (owner == Thread.currentThread()))
- return this.lock();
- else
- return Semaphore.SM_WOULD_BLOCK;
- }
- }
-
- private Thread owner;
-
- private int useCount;
-
- private Hashtable waiters;
-
- private int numberOfResources;
-
- private String semKey;
-
- private static final Map<String, BasicSemaphore> semaphores = new HashMap<String, BasicSemaphore>();
-
-}
Modified: labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/LockManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/LockManager.java 2010-02-22 18:34:40 UTC (rev 31778)
+++ labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/LockManager.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -32,9 +32,9 @@
package com.arjuna.ats.txoj;
import com.arjuna.ats.txoj.lockstore.*;
-import com.arjuna.ats.txoj.semaphore.*;
import com.arjuna.ats.arjuna.*;
import com.arjuna.ats.arjuna.common.*;
+import com.arjuna.ats.arjuna.common.Mutex;
import com.arjuna.ats.arjuna.StateManager;
import com.arjuna.ats.txoj.logging.txojLogger;
@@ -51,7 +51,6 @@
import com.arjuna.ats.internal.txoj.abstractrecords.LockRecord;
import com.arjuna.ats.internal.txoj.lockstore.BasicLockStore;
import com.arjuna.ats.internal.txoj.lockstore.BasicPersistentLockStore;
-import com.arjuna.ats.internal.txoj.semaphore.BasicSemaphore;
import com.arjuna.ats.txoj.common.txojPropertyManager;
import java.io.PrintWriter;
import java.util.*;
@@ -161,7 +160,7 @@
if (mutex != null)
{
- if (mutex.lock() == Semaphore.SM_LOCKED)
+ if (mutex.lock() == Mutex.LOCKED)
doSignal = true;
}
@@ -1026,12 +1025,12 @@
{
// TODO add a factory if we ever have more than one implementation
- mutex = new BasicSemaphore(systemKey);
+ mutex = new com.arjuna.ats.internal.arjuna.common.BasicMutex();
}
if (mutex != null)
{
- if (mutex.lock() == Semaphore.SM_LOCKED)
+ if (mutex.lock() == Mutex.LOCKED)
{
/*
* At some point we may want to add a factory to hide this, but
@@ -1120,7 +1119,7 @@
return false; /* init failed */
}
- if ((mutex == null) || (mutex.tryLock() == Semaphore.SM_WOULD_BLOCK))
+ if ((mutex == null) || (mutex.tryLock() == Mutex.WOULD_BLOCK))
{
return false;
}
@@ -1431,7 +1430,7 @@
private boolean objectLocked;/* Semaphore grabbed */
- private Semaphore mutex; /* Controls access to the lock store */
+ private com.arjuna.ats.internal.arjuna.common.BasicMutex mutex; /* Controls access to the lock store */
private LockConflictManager conflictManager;
Deleted: labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/semaphore/Semaphore.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/semaphore/Semaphore.java 2010-02-22 18:34:40 UTC (rev 31778)
+++ labs/jbosstm/trunk/ArjunaCore/txoj/classes/com/arjuna/ats/txoj/semaphore/Semaphore.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006,
- * @author JBoss Inc.
- */
-/*
- * Copyright (C) 1998, 1999, 2000,
- *
- * Arjuna Solutions Limited,
- * Newcastle upon Tyne,
- * Tyne and Wear,
- * UK.
- *
- * $Id: Semaphore.java 2342 2006-03-30 13:06:17Z $
- */
-
-package com.arjuna.ats.txoj.semaphore;
-
-import com.arjuna.ats.internal.txoj.Implementations;
-
-/**
- * Implementations of semaphore classes should derive from this
- * class and provide implementations of the relevant methods.
- *
- * @author Mark Little (mark at arjuna.com)
- * @version $Id: SemaphoreImple.java 2342 2006-03-30 13:06:17Z $
- * @since JTS 1.0.
- */
-
-public abstract class Semaphore
-{
-
- public static final int SM_LOCKED = 0;
-
- public static final int SM_UNLOCKED = 1;
-
- public static final int SM_WOULD_BLOCK = 2;
-
- public static final int SM_ERROR = 3;
-
- /*
- * Classic semaphore operations.
- */
-
- public abstract int lock ();
-
- public abstract int unlock ();
-
- public abstract int tryLock ();
-
- static
- {
- if (!Implementations.added())
- Implementations.initialise();
- }
-
-}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/FactoryList.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/FactoryList.java 2010-02-22 18:34:40 UTC (rev 31778)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/interposition/FactoryList.java 2010-02-23 00:19:27 UTC (rev 31779)
@@ -31,11 +31,11 @@
package com.arjuna.ats.internal.jts.interposition;
-import com.arjuna.ats.arjuna.common.Mutex;
import com.arjuna.ats.jts.extensions.Arjuna;
import com.arjuna.ats.jts.logging.*;
+import com.arjuna.ats.internal.arjuna.common.BasicMutex;
import com.arjuna.ats.internal.jts.interposition.resources.arjuna.InterpositionCreator;
import com.arjuna.ats.internal.jts.interposition.resources.strict.StrictInterpositionCreator;
import com.arjuna.ats.internal.jts.interposition.resources.restricted.RestrictedInterpositionCreator;
@@ -265,6 +265,6 @@
private static FactoryElement _list = null;
private static FactoryElement _default = null; // used if no formatID
// values match.
- private static Mutex _lock = new Mutex();
+ private static BasicMutex _lock = new BasicMutex();
}
More information about the jboss-svn-commits
mailing list