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 release-notes.txt
Date Thu, 30 Sep 2004 14:02:04 GMT
arminw      2004/09/30 07:02:03

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE RsIterator.java
               src/java/org/apache/ojb/broker/cache Tag: OJB_1_0_RELEASE
                        InternalCache.java
               src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        PersistenceBrokerImpl.java
               .        Tag: OJB_1_0_RELEASE release-notes.txt
  Log:
  Fix materialization problem under heavy load, OJB no longer returns partially materialized
  objects from cache (problem of InternalCache#enable.... method).
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.63.2.3  +27 -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.2
  retrieving revision 1.63.2.3
  diff -u -r1.63.2.2 -r1.63.2.3
  --- RsIterator.java	9 Aug 2004 07:51:26 -0000	1.63.2.2
  +++ RsIterator.java	30 Sep 2004 14:02:03 -0000	1.63.2.3
  @@ -452,26 +452,32 @@
                       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);
  +                            /*
  +                             * 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);
  +                        }
  +                        finally
  +                        {
  +                            getCache().disableMaterializationCache();
  +                        }
                       }
                   }
               }
  
  
  
  No                   revision
  No                   revision
  1.5.2.1   +18 -3     db-ojb/src/java/org/apache/ojb/broker/cache/Attic/InternalCache.java
  
  Index: InternalCache.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/cache/Attic/InternalCache.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- InternalCache.java	25 Jun 2004 16:09:50 -0000	1.5
  +++ InternalCache.java	30 Sep 2004 14:02:03 -0000	1.5.2.1
  @@ -40,6 +40,7 @@
       private ObjectCache realCache;
       private HashMap localCache;
       private boolean enabledReadCache;
  +    private int invokeCounter;
   
       public InternalCache(ObjectCache realCache)
       {
  @@ -50,13 +51,25 @@
   
       public void enableMaterializationCache()
       {
  +        ++invokeCounter;
           enabledReadCache = true;
       }
   
       public void disableMaterializationCache()
       {
  -        enabledReadCache = false;
  -        pushToRealCache();
  +        if(enabledReadCache)
  +        {
  +            --invokeCounter;
  +            /*
  +            if materialization of the requested object was completed, the
  +            counter represents '0'
  +            */
  +            if (invokeCounter == 0)
  +            {
  +                enabledReadCache = false;
  +                pushToRealCache();
  +            }
  +        }
       }
   
       private void pushToRealCache()
  @@ -114,6 +127,8 @@
                       " push to real ObjectCache");
           }
           localCache.clear();
  +        invokeCounter = 0;
  +        enabledReadCache = false;
       }
   
       public void clear()
  
  
  
  No                   revision
  No                   revision
  1.83.2.4  +40 -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.3
  retrieving revision 1.83.2.4
  diff -u -r1.83.2.3 -r1.83.2.4
  --- PersistenceBrokerImpl.java	21 Sep 2004 00:29:01 -0000	1.83.2.3
  +++ PersistenceBrokerImpl.java	30 Sep 2004 14:02:03 -0000	1.83.2.4
  @@ -446,6 +446,21 @@
           {
               logger.warn("No running tx found, please only delete objects in context of
an PB-transaction" +
                       ", to avoid side-effects - e.g. when rollback of complex objects");
  +            /*
  +            arminw:
  +            this could help user to find missing tx declaration
  +            */
  +            if(logger.isEnabledFor(Logger.INFO))
  +            {
  +                try
  +                {
  +                    throw new Exception("** Try to delete object without active PersistenceBroker
transaction **");
  +                }
  +                catch(Exception e)
  +                {
  +                    e.printStackTrace();
  +                }
  +            }
           }
           try
           {
  @@ -1336,8 +1351,15 @@
       public Object getObjectByIdentity(Identity id) throws PersistenceBrokerException
       {
           objectCache.enableMaterializationCache();
  -        Object result = doGetObjectByIdentity(id);
  -        objectCache.disableMaterializationCache();
  +        Object result;
  +        try
  +        {
  +            result = doGetObjectByIdentity(id);
  +        }
  +        finally
  +        {
  +            objectCache.disableMaterializationCache();
  +        }
           return result;
       }
   
  @@ -1527,6 +1549,21 @@
           {
               logger.warn("No running tx found, please only store in context of an PB-transaction"
+
                       ", to avoid side-effects - e.g. when rollback of complex objects");
  +            /*
  +            arminw:
  +            this could help user to find missing tx declaration
  +            */
  +            if(logger.isEnabledFor(Logger.INFO))
  +            {
  +                try
  +                {
  +                    throw new Exception("** Try to store object without active PersistenceBroker
transaction **");
  +                }
  +                catch(Exception e)
  +                {
  +                    e.printStackTrace();
  +                }
  +            }
           }
           // Invoke events on PersistenceBrokerAware instances and listeners
           if (insert)
  
  
  
  No                   revision
  No                   revision
  1.54.2.14 +3 -1      db-ojb/release-notes.txt
  
  Index: release-notes.txt
  ===================================================================
  RCS file: /home/cvs/db-ojb/release-notes.txt,v
  retrieving revision 1.54.2.13
  retrieving revision 1.54.2.14
  diff -u -r1.54.2.13 -r1.54.2.14
  --- release-notes.txt	21 Sep 2004 00:29:02 -0000	1.54.2.13
  +++ release-notes.txt	30 Sep 2004 14:02:03 -0000	1.54.2.14
  @@ -40,6 +40,8 @@
   under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx
   to see details for a bug with id OJBxxx.
   
  +- Fix materialization problem under heavy load, OJB no longer returns partially materialized
  +objects from cache.
   - Fix key constraint problems when insert m:n relation manually via "linking"
   - Fix bug in SequenceManagerNativeImpl used to support DB identity columns, make counter
for
     temporary keys static to prevent lock not granted exceptions on insert of new objects.
  
  
  

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