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, 05 Mar 2004 00:38:06 GMT
olegnitz    2004/03/04 16:38:06

  Modified:    src/java/org/apache/ojb/otm/core ConcreteEditingContext.java
  Log:
  Removed some unnecessary actions for the "long transactions" use of makePersistent
  
  Revision  Changes    Path
  1.40      +11 -6     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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- ConcreteEditingContext.java	4 Mar 2004 22:45:02 -0000	1.39
  +++ ConcreteEditingContext.java	5 Mar 2004 00:38:06 -0000	1.40
  @@ -174,6 +174,10 @@
           Swizzling swizzlingStrategy;
           IndirectionHandler handler = null;
           OTMKit kit = _tx.getKit();
  +        // Are we building object's relations for the object in the transaction?
  +        // Otherwise we just get data from the "newObj" and put it into
  +        // the previously loaded/created object in the transaction
  +        boolean buildingObject = false;
   
           if (lock == LockType.NO_LOCK)
           {
  @@ -215,7 +219,8 @@
                       // just do nothing
                       return null;
                   }
  -                
  +
  +                buildingObject = true;
                   _objects.put(oid, entry);
                   lockManager.ensureLock(oid, _tx, lock, _pb); // lock after _objects.put
to avoid hanged locks
   
  @@ -288,7 +293,7 @@
           if ((handler == null) && (newObj != null) && !stack.contains(newObj))
           {
               stack.push(newObj);
  -            lockReachableObjects(oid, newObj, lock, stack);
  +            lockReachableObjects(oid, newObj, lock, stack, buildingObject);
               stack.pop();
           }
   
  @@ -401,7 +406,7 @@
           // if the inserted object is materialized
           try
           {
  -            lockReachableObjects(oid, object, lock, new Stack());
  +            lockReachableObjects(oid, object, lock, new Stack(), true);
           }
           catch (LockingException ex)
           {
  @@ -723,7 +728,7 @@
        * @param lock The lock type to use
        */
       private void lockReachableObjects(Identity oid, Object object, int lock,
  -                                      Stack stack)
  +                                      Stack stack, boolean buildingObject)
           throws LockingException
       {
           ContextEntry entry;
  @@ -756,7 +761,7 @@
                   if (cntxRelObj != relObj)
                   {
                       entry = insertInternal(relOid, relObj, lock, false, isDependent, oid,
stack);
  -                    if (entry != null) 
  +                    if (buildingObject && (entry != null))
                       {
                           f.set(object, entry.object);
                       }
  @@ -818,7 +823,7 @@
                       if (cntxRelObj != relObj)
                       {
                           entry = insertInternal(relOid, relObj, lock, false, isDependent,
null, stack);
  -                        if (entry != null)
  +                        if (buildingObject && (entry != null))
                           {
                               cntxRelObj = entry.object;
                               needToReplaceCollection = true;
  
  
  

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