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/util BrokerHelper.java
Date Mon, 10 Oct 2005 00:00:33 GMT
arminw      2005/10/09 17:00:33

  Modified:    src/java/org/apache/ojb/broker/util Tag: OJB_1_0_RELEASE
                        BrokerHelper.java
  Log:
  use Object identity based map to cache SqlStatement, minor improvement
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.57.2.19 +13 -21    db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java
  
  Index: BrokerHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java,v
  retrieving revision 1.57.2.18
  retrieving revision 1.57.2.19
  diff -u -r1.57.2.18 -r1.57.2.19
  --- BrokerHelper.java	9 Aug 2005 20:03:22 -0000	1.57.2.18
  +++ BrokerHelper.java	10 Oct 2005 00:00:33 -0000	1.57.2.19
  @@ -18,23 +18,23 @@
   import java.sql.PreparedStatement;
   import java.sql.ResultSet;
   import java.sql.SQLException;
  +import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
   import java.util.StringTokenizer;
  -import java.util.WeakHashMap;
  -import java.util.ArrayList;
   
  -import org.apache.commons.collections.iterators.ArrayIterator;
   import org.apache.commons.collections.CollectionUtils;
  +import org.apache.commons.collections.iterators.ArrayIterator;
  +import org.apache.commons.collections.map.ReferenceIdentityMap;
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.ManageableCollection;
  +import org.apache.ojb.broker.MtoNImplementor;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.PersistenceBrokerSQLException;
  -import org.apache.ojb.broker.MtoNImplementor;
   import org.apache.ojb.broker.accesslayer.StatementManagerIF;
   import org.apache.ojb.broker.accesslayer.sql.SqlExistStatement;
   import org.apache.ojb.broker.core.PersistenceBrokerImpl;
  @@ -114,8 +114,7 @@
           {
               passwd = "";
           }
  -        PBKey key = new PBKey(dbName, user, passwd);
  -        return key;
  +        return new PBKey(dbName, user, passwd);
       }
   
       /**
  @@ -420,7 +419,7 @@
       /**
        * Extract an value array of the given {@link ValueContainer} array.
        * @param containers
  -     * @return
  +     * @return An object array
        */
       public Object[] extractValueArray(ValueContainer[] containers)
       {
  @@ -491,7 +490,7 @@
       /**
        * Build a Count-Query based on aQuery
        * @param aQuery
  -     * @return
  +     * @return The count query
        */
       public Query getCountQuery(Query aQuery)
       {
  @@ -513,7 +512,7 @@
        * Create a Count-Query for QueryBySQL
        *
        * @param aQuery
  -     * @return
  +     * @return The count query
        */
       private Query getQueryBySqlCount(QueryBySQL aQuery)
       {
  @@ -536,9 +535,6 @@
   
       /**
        * Create a Count-Query for QueryByCriteria
  -     *
  -     * @param aQuery
  -     * @return
        */
       private Query getQueryByCriteriaCount(QueryByCriteria aQuery)
       {
  @@ -637,9 +633,6 @@
   
       /**
        * Create a Count-Query for ReportQueryByCriteria
  -     *
  -     * @param aQuery
  -     * @return
        */
       private Query getReportQueryByCriteriaCount(ReportQueryByCriteria aQuery)
       {
  @@ -670,11 +663,10 @@
   
   
       /*
  -    NOTE: use WeakHashMap to allow reclaiming of no longer used ClassDescriptor
  -    instances
  +    NOTE: use weak key references to allow reclaiming
  +    of no longer used ClassDescriptor instances
       */
  -    private Map sqlSelectMap = new WeakHashMap();
  -
  +    private Map sqlSelectMap = new ReferenceIdentityMap(ReferenceIdentityMap.WEAK, ReferenceIdentityMap.HARD);
       /**
        * TODO: This method should be moved to {@link org.apache.ojb.broker.accesslayer.JdbcAccess}
        * before 1.1 release. This method only checks if the requested object can be
  @@ -1012,7 +1004,7 @@
        */
       public static Object[] getCollectionArray(Object collectionOrArray)
       {
  -        Object[] result = null;
  +        Object[] result;
           if (collectionOrArray instanceof Collection)
           {
               result = ((Collection) collectionOrArray).toArray();
  
  
  

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