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/broker/core PersistenceBrokerImpl.java
Date Mon, 04 Oct 2004 13:19:50 GMT
arminw      2004/10/04 06:19:50

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE RsIterator.java
               src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        PersistenceBrokerImpl.java
  Log:
  update fix for materialization problem, catch exceptions to guarantee
  clearing of materialization cache, more info see history
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.63.2.5  +26 -21    db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
  
  Index: RsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java,v
  retrieving revision 1.63.2.4
  retrieving revision 1.63.2.5
  diff -u -r1.63.2.4 -r1.63.2.5
  --- RsIterator.java	1 Oct 2004 11:02:08 -0000	1.63.2.4
  +++ RsIterator.java	4 Oct 2004 13:19:49 -0000	1.63.2.5
  @@ -452,26 +452,31 @@
                       synchronized (result)
                       {
                           getCache().enableMaterializationCache();
  -                        getCache().cache(oid, result);
  -                        /*
  -                         * arminw: move LoadedObjectsRegistry to odmg-layer
  -                         */
  -                        // LoadedObjectsRegistry.register(result);
  -                        /**
  -                         * MBAIRD if you have multiple classes mapped to a
  -                         * table, and you query on the base class you could get
  -                         * back NON base class objects, so we shouldn't pass
  -                         * m_cld, but rather the class descriptor for the
  -                         * actual class.
  -                         */
  -                        // fill reference and collection attributes
  -                        ClassDescriptor cld = getBroker().getClassDescriptor(result.getClass());
  -                        // don't force loading of reference
  -                        final boolean unforced = false;
  -                        // Maps ReferenceDescriptors to HashSets of owners
  -                        getBroker().getReferenceBroker().retrieveReferences(result, cld,
unforced);
  -                        getBroker().getReferenceBroker().retrieveCollections(result, cld,
unforced);
  -                        getCache().disableMaterializationCache();
  +                        try
  +                        {
  +                            getCache().cache(oid, result);
  +                            /**
  +                             * MBAIRD if you have multiple classes mapped to a
  +                             * table, and you query on the base class you could get
  +                             * back NON base class objects, so we shouldn't pass
  +                             * m_cld, but rather the class descriptor for the
  +                             * actual class.
  +                             */
  +                            // fill reference and collection attributes
  +                            ClassDescriptor cld = getBroker().getClassDescriptor(result.getClass());
  +                            // don't force loading of reference
  +                            final boolean unforced = false;
  +                            // Maps ReferenceDescriptors to HashSets of owners
  +                            getBroker().getReferenceBroker().retrieveReferences(result,
cld, unforced);
  +                            getBroker().getReferenceBroker().retrieveCollections(result,
cld, unforced);
  +                            getCache().disableMaterializationCache();
  +                        }
  +                        catch(RuntimeException e)
  +                        {
  +                            // catch runtime exc. to guarantee clearing of internal buffer
on failure
  +                            getCache().localClear();
  +                            throw e;
  +                        }
                       }
                   }
               }
  
  
  
  No                   revision
  No                   revision
  1.83.2.6  +13 -3     db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.83.2.5
  retrieving revision 1.83.2.6
  diff -u -r1.83.2.5 -r1.83.2.6
  --- PersistenceBrokerImpl.java	1 Oct 2004 11:02:08 -0000	1.83.2.5
  +++ PersistenceBrokerImpl.java	4 Oct 2004 13:19:49 -0000	1.83.2.6
  @@ -1351,8 +1351,18 @@
       public Object getObjectByIdentity(Identity id) throws PersistenceBrokerException
       {
           objectCache.enableMaterializationCache();
  -        Object result = doGetObjectByIdentity(id);
  -        objectCache.disableMaterializationCache();
  +        Object result = null;
  +        try
  +        {
  +            result = doGetObjectByIdentity(id);
  +            objectCache.disableMaterializationCache();
  +        }
  +        catch(RuntimeException e)
  +        {
  +            // catch runtime exc. to guarantee clearing of internal buffer on failure
  +            objectCache.localClear();
  +            throw e;
  +        }
           return result;
       }
   
  
  
  

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