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/singlevm PersistenceBrokerImpl.java
Date Tue, 11 Feb 2003 20:33:49 GMT
arminw      2003/02/11 12:33:49

  Modified:    src/java/org/apache/ojb/broker/singlevm
                        PersistenceBrokerImpl.java
  Log:
  minor fix for markedForDelete objects
  
  Revision  Changes    Path
  1.127     +17 -27    db-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
  retrieving revision 1.126
  retrieving revision 1.127
  diff -u -r1.126 -r1.127
  --- PersistenceBrokerImpl.java	6 Feb 2003 17:42:11 -0000	1.126
  +++ PersistenceBrokerImpl.java	11 Feb 2003 20:33:48 -0000	1.127
  @@ -170,10 +170,11 @@
       private PBKey pbKey;
   
   	/**
  -	 * Maps for object registration during store and delete operations. We reuse these maps
to avoid excessive object
  -	 * creation.
  +	 * Lists for object registration during delete operations.
  +     * We reuse these list to avoid excessive object creation.
  +     * @see #clearRegistrationLists
   	 */
  -	private Map m_markedForDelete;
  +	private List markedForDelete;
   
       protected PersistenceBrokerImpl()
       {
  @@ -199,6 +200,8 @@
           statementManager = StatementManagerFactory.getInstance().createStatementManager(this);
           sqlGenerator = SqlGeneratorFactory.getInstance().createSqlGenerator(
                           connectionManager.getSupportedPlatform());
  +
  +        markedForDelete = new ArrayList();
       }
   
   
  @@ -335,7 +338,7 @@
           {
               throw new TransactionNotInProgressException();
           }
  -		clearRegistrationMaps();
  +		clearRegistrationLists();
           this.connectionManager.localRollback();
       }
   
  @@ -370,7 +373,7 @@
           {
               throw new TransactionNotInProgressException();
           }
  -		clearRegistrationMaps();
  +		clearRegistrationLists();
   
           this.connectionManager.localCommit();
       }
  @@ -389,26 +392,16 @@
                * MBAIRD
                * 1. if we are marked for delete already, avoid recursing on this object
                */
  -			if (m_markedForDelete != null)
  -			{
  -				if (m_markedForDelete.containsKey(obj))
  -				{
  -					return;
  -				}
  -			}
  -			else
  -			{
  -				/**
  -				 * Optimization: Lazily instantiate the markedForDelete Map.
  -				 */
  -				m_markedForDelete = new HashMap();
  -			}
  +            if (markedForDelete.contains(obj))
  +            {
  +                return;
  +            }
  +
               /**
                * MBAIRD
                * 2. register object in markedForDelete map.
                */
  -            m_markedForDelete.put(obj, obj);
  -
  +            markedForDelete.add(obj);
               // Invoke events on PersistenceBrokerAware instances and listeners
               fireBrokerEvent(obj, EVENT_BEFORE_DELETE);
   
  @@ -2257,12 +2250,9 @@
       /**
        * clean up the maps for reuse by the next transaction.
        */
  -    private void clearRegistrationMaps()
  +    private void clearRegistrationLists()
       {
  -        if (m_markedForDelete != null)
  -        {
  -            m_markedForDelete.clear();
  -        }
  +        markedForDelete.clear();
       }
   
   // ************************************************************************
  
  
  

Mime
View raw message