db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/odmg/locking LockManagerOdmgImpl.java
Date Fri, 26 Nov 2004 19:38:05 GMT
arminw      2004/11/26 11:38:05

  Modified:    src/java/org/apache/ojb/broker/cache
                        ObjectCacheDefaultImpl.java
               src/java/org/apache/ojb/odmg/locking
                        LockManagerOdmgImpl.java
  Log:
  fix, use Identity as key value again
  
  Revision  Changes    Path
  1.29      +6 -13     db-ojb/src/java/org/apache/ojb/broker/cache/ObjectCacheDefaultImpl.java
  
  Index: ObjectCacheDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/cache/ObjectCacheDefaultImpl.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ObjectCacheDefaultImpl.java	18 Sep 2004 17:28:58 -0000	1.28
  +++ ObjectCacheDefaultImpl.java	26 Nov 2004 19:38:05 -0000	1.29
  @@ -21,7 +21,7 @@
   import java.util.Map;
   import java.util.Properties;
   
  -import org.apache.commons.collections.LRUMap;
  +import org.apache.commons.collections.map.LRUMap;
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.lang.builder.ToStringStyle;
   import org.apache.ojb.broker.Identity;
  @@ -133,11 +133,10 @@
           processQueue();
           if ((obj != null))
           {
  -            Integer key = buildKey(oid);
               CacheEntry entry = buildEntry(obj, oid);
               synchronized (dummy)
               {
  -                objectTable.put(key, entry);
  +                objectTable.put(oid, entry);
               }
           }
       }
  @@ -150,7 +149,7 @@
       {
           processQueue();
           Object result = null;
  -        CacheEntry entry = (CacheEntry) objectTable.get(buildKey(oid));
  +        CacheEntry entry = (CacheEntry) objectTable.get(oid);
           if (entry != null)
           {
               result = entry.get();
  @@ -176,19 +175,13 @@
           processQueue();
           if (oid != null)
           {
  -            Integer key = buildKey(oid);
               synchronized (dummy)
               {
  -                objectTable.remove(key);
  +                objectTable.remove(oid);
               }
           }
       }
   
  -    private Integer buildKey(Identity oid)
  -    {
  -        return new Integer(oid.hashCode());
  -    }
  -
       private void processQueue()
       {
           if (useSoftReferences)
  @@ -196,7 +189,7 @@
               CacheEntry entry;
               while ((entry = (CacheEntry) queue.poll()) != null)
               {
  -                objectTable.remove(buildKey(entry.getOid()));
  +                objectTable.remove(entry.getOid());
               }
           }
       }
  
  
  
  1.3       +6 -6      db-ojb/src/java/org/apache/ojb/odmg/locking/LockManagerOdmgImpl.java
  
  Index: LockManagerOdmgImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/locking/LockManagerOdmgImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LockManagerOdmgImpl.java	20 Sep 2004 14:30:57 -0000	1.2
  +++ LockManagerOdmgImpl.java	26 Nov 2004 19:38:05 -0000	1.3
  @@ -45,7 +45,7 @@
       public boolean readLock(TransactionImpl tx, Identity oid, Object obj)
       {
           ClassDescriptor cld = tx.getBroker().getClassDescriptor(ProxyHelper.getRealClass(obj));
  -        return lm.readLock(tx.getGUID(), new Integer(oid.hashCode()), cld.getIsolationLevel());
  +        return lm.readLock(tx.getGUID(), oid, cld.getIsolationLevel());
       }
   
       public boolean writeLock(TransactionImpl tx, Object obj)
  @@ -57,7 +57,7 @@
       public boolean writeLock(TransactionImpl tx, Identity oid, Object obj)
       {
           ClassDescriptor cld = tx.getBroker().getClassDescriptor(ProxyHelper.getRealClass(obj));
  -        return lm.writeLock(tx.getGUID(), new Integer(oid.hashCode()), cld.getIsolationLevel());
  +        return lm.writeLock(tx.getGUID(), oid, cld.getIsolationLevel());
       }
   
       public boolean upgradeLock(TransactionImpl tx, Object obj)
  @@ -69,7 +69,7 @@
       public boolean upgradeLock(TransactionImpl tx, Identity oid, Object obj)
       {
           ClassDescriptor cld = tx.getBroker().getClassDescriptor(ProxyHelper.getRealClass(obj));
  -        return lm.upgradeLock(tx.getGUID(), new Integer(oid.hashCode()), cld.getIsolationLevel());
  +        return lm.upgradeLock(tx.getGUID(), oid, cld.getIsolationLevel());
       }
   
       public boolean releaseLock(TransactionImpl tx, Object obj)
  @@ -81,7 +81,7 @@
       public boolean releaseLock(TransactionImpl tx, Identity oid, Object obj)
       {
           ClassDescriptor cld = tx.getBroker().getClassDescriptor(ProxyHelper.getRealClass(obj));
  -        return lm.releaseLock(tx.getGUID(), new Integer(oid.hashCode()), cld.getIsolationLevel());
  +        return lm.releaseLock(tx.getGUID(), oid, cld.getIsolationLevel());
       }
   
       public boolean checkRead(TransactionImpl tx, Object obj)
  @@ -93,7 +93,7 @@
       public boolean checkRead(TransactionImpl tx, Identity oid, Object obj)
       {
           ClassDescriptor cld = tx.getBroker().getClassDescriptor(ProxyHelper.getRealClass(obj));
  -        return lm.checkRead(tx.getGUID(), new Integer(oid.hashCode()), cld.getIsolationLevel());
  +        return lm.checkRead(tx.getGUID(), oid, cld.getIsolationLevel());
       }
   
       public boolean checkWrite(TransactionImpl tx, Object obj)
  @@ -105,6 +105,6 @@
       public boolean checkWrite(TransactionImpl tx, Identity oid, Object obj)
       {
           ClassDescriptor cld = tx.getBroker().getClassDescriptor(ProxyHelper.getRealClass(obj));
  -        return lm.checkWrite(tx.getGUID(), new Integer(oid.hashCode()), cld.getIsolationLevel());
  +        return lm.checkWrite(tx.getGUID(), oid, cld.getIsolationLevel());
       }
   }
  
  
  

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


Mime
View raw message