commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ozeigerm...@apache.org
Subject svn commit: r555573 - in /jakarta/commons/proper/transaction/branches/TRANSACTION_2: ./ example/ lib/ src/java/org/apache/commons/ src/java/org/apache/transaction/ src/java/org/apache/transaction/file/ src/java/org/apache/transaction/locking/
Date Thu, 12 Jul 2007 10:37:31 GMT
Author: ozeigermann
Date: Thu Jul 12 03:37:26 2007
New Revision: 555573

URL: http://svn.apache.org/viewvc?view=rev&rev=555573
Log:
Initial new source for 2.0

Added:
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/file/
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/GenericLockManager.java
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/LockManager.java
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/NativeLockManager.java
Removed:
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/example/
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/lib/
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/commons/
Modified:
    jakarta/commons/proper/transaction/branches/TRANSACTION_2/NOTICE.txt

Modified: jakarta/commons/proper/transaction/branches/TRANSACTION_2/NOTICE.txt
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/NOTICE.txt?view=diff&rev=555573&r1=555572&r2=555573
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/NOTICE.txt (original)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/NOTICE.txt Thu Jul 12 03:37:26
2007
@@ -1,5 +1,5 @@
 Apache Jakarta Commons Transaction
-Copyright 1999-2004 The Apache Software Foundation
+Copyright 1999-2007 The Apache Software Foundation
 
 This product includes software developed by
 The Apache Software Foundation (http://www.apache.org/).

Added: jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/GenericLockManager.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/GenericLockManager.java?view=auto&rev=555573
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/GenericLockManager.java
(added)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/GenericLockManager.java
Thu Jul 12 03:37:26 2007
@@ -0,0 +1,31 @@
+package org.apache.transaction.locking;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+public class GenericLockManager<K, L> implements LockManager<K, L> {
+    
+    private final ConcurrentHashMap<K, L> globalLocks = new ConcurrentHashMap<K,
L>();
+
+    @Override
+    public L getLock(K key) {
+        return globalLocks.get(key);
+    }
+    
+    @Override
+    public L createLockIfAbsent(K key, L lock) {
+        L existingLock = getLock(key);
+        if (existingLock == null) {
+            L concurrentlyInsertedLock = globalLocks.putIfAbsent(key, lock);
+            if (concurrentlyInsertedLock != null)
+                lock = concurrentlyInsertedLock;
+        }
+        return lock;
+        
+    }
+    
+    @Override
+    public L removeLock(K key) {
+        return globalLocks.remove(key);
+    }
+
+}

Added: jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/LockManager.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/LockManager.java?view=auto&rev=555573
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/LockManager.java
(added)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/LockManager.java
Thu Jul 12 03:37:26 2007
@@ -0,0 +1,10 @@
+package org.apache.transaction.locking;
+
+public interface LockManager<K, L> {
+    public L getLock(K key);
+
+    public L createLockIfAbsent(K key, L lock);
+
+    public L removeLock(K key);
+
+}

Added: jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/NativeLockManager.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/NativeLockManager.java?view=auto&rev=555573
==============================================================================
--- jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/NativeLockManager.java
(added)
+++ jakarta/commons/proper/transaction/branches/TRANSACTION_2/src/java/org/apache/transaction/locking/NativeLockManager.java
Thu Jul 12 03:37:26 2007
@@ -0,0 +1,5 @@
+package org.apache.transaction.locking;
+
+
+public class NativeLockManager extends GenericLockManager<Object, Object> implements
LockManager<Object, Object> {
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message