db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olegn...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/otm/core ConcreteEditingContext.java
Date Fri, 25 Jul 2003 22:49:08 GMT
olegnitz    2003/07/25 15:49:08

  Modified:    src/java/org/apache/ojb/otm/core ConcreteEditingContext.java
  Log:
  Back to ArrayList for the order
  
  Revision  Changes    Path
  1.23      +14 -20    db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java
  
  Index: ConcreteEditingContext.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/otm/core/ConcreteEditingContext.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ConcreteEditingContext.java	25 Jul 2003 00:22:00 -0000	1.22
  +++ ConcreteEditingContext.java	25 Jul 2003 22:49:08 -0000	1.23
  @@ -118,7 +118,7 @@
       private HashSet _withoutBidirAssc;
   
       private HashMap _objects;
  -    private HashMap _order;
  +    private ArrayList _order;
       private Transaction _tx;
       private PersistenceBroker _pb;
       private HashMap _original;
  @@ -135,7 +135,7 @@
           _tx = tx;
           _pb = pb;
           _objects = new HashMap();
  -        _order = new HashMap();
  +        _order = new ArrayList();
           _original = new HashMap();
           _checkpointed = _original;
           pbkey = _pb.getPBKey();
  @@ -244,6 +244,7 @@
                   }
               }
               _objects.put(oid, entry);
  +            _order.add(oid);
           }
           else
           {
  @@ -282,11 +283,6 @@
               }
           }
   
  -        if (_order.get(oid)==null)
  -        {
  -            _order.put(oid,oid);
  -        }
  -
           // perform automatic read lock for all reachable objects
           // if the inserted object is materialized
           if ((handler == null) && (newObj != null))
  @@ -311,12 +307,10 @@
       {
           ContextEntry entry;
   
  -        if (_order.get(oid)!=null)
  -        {
  -            _order.remove(oid);
  -        }
           entry = insertInternal(oid, object, LockType.WRITE_LOCK, true, false);
           entry.state = entry.state.deletePersistent();
  +        _order.remove(oid);
  +        _order.add(oid);
       }
   
       /**
  @@ -412,7 +406,7 @@
       {
           checkpointInternal();
           _checkpointed = new HashMap();
  -        for (Iterator iterator = _order.keySet().iterator(); iterator.hasNext();)
  +        for (Iterator iterator = _order.iterator(); iterator.hasNext();)
           {
               Identity oid = (Identity) iterator.next();
               ContextEntry entry = (ContextEntry) _objects.get(oid);
  @@ -436,7 +430,7 @@
           boolean saveBatchMode = connMan.isBatchMode();
           Swizzling swizzlingStrategy = _tx.getKit().getSwizzlingStrategy();
           LockManager lockManager = LockManager.getInstance();
  -        Identity[] lockOrder = (Identity[]) _order.keySet().toArray(new Identity[_order.size()]);
  +        Identity[] lockOrder = (Identity[]) _order.toArray(new Identity[_order.size()]);
           ObjectCache cache = _pb.serviceObjectCache();
           boolean isInsertVerified = _tx.getKit().isInsertVerified();
   
  @@ -531,7 +525,7 @@
               }
               while (countNewObjects > 0);
   
  -            Identity[] order = (Identity[]) _order.keySet().toArray(new Identity[_order.size()]);
  +            Identity[] order = (Identity[]) _order.toArray(new Identity[_order.size()]);
   
               // Swizzle the context objects and the cache objects
               for (int i = 0; i < order.length; i++)
  @@ -636,7 +630,7 @@
        */
       public void rollback()
       {
  -        for (Iterator iterator = _order.keySet().iterator(); iterator.hasNext();)
  +        for (Iterator iterator = _order.iterator(); iterator.hasNext();)
           {
               Identity oid = (Identity) iterator.next();
               ContextEntry entry = (ContextEntry) _objects.get(oid);
  @@ -680,8 +674,8 @@
   
           // N:1 relations
           Iterator iter = mif.getObjectReferenceDescriptors().iterator();
  -        ObjectReferenceDescriptor rds;
  -        Object relObj;
  +        ObjectReferenceDescriptor rds = null;
  +        Object relObj = null;
           Identity relOid;
   
           while (iter.hasNext())
  @@ -695,7 +689,7 @@
               if (relObj != null)
               {
                   relOid = new Identity(relObj, _pb);
  -                if (_order.get(relOid)==null)
  +                if (_objects.get(relOid) == null)
                   {
                       insertInternal(relOid, relObj, LockType.READ_LOCK, false,
                                      rds.getOtmDependent());
  @@ -738,7 +732,7 @@
                   {
                       relObj = colIterator.next();
                       relOid = new Identity(relObj, _pb);
  -                    if (_order.get(relOid) == null)
  +                    if (_objects.get(relOid) == null)
                       {
                           insertInternal(relOid, relObj, LockType.READ_LOCK, false,
                                          collectionDescriptor.getOtmDependent());
  @@ -1116,7 +1110,7 @@
   
           entry.state = State.PERSISTENT_NEW;
           _objects.put(oid, entry);
  -        _order.put(oid,oid);
  +        _order.add(oid);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
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