db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henn...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/util BasePeer.java LargeSelect.java
Date Mon, 25 Aug 2003 16:33:23 GMT
henning     2003/08/25 09:33:23

  Modified:    src/java/org/apache/torque/manager MethodResultCache.java
               src/java/org/apache/torque/oid IDBroker.java
                        SequenceIdGenerator.java
               src/java/org/apache/torque/util BasePeer.java
                        LargeSelect.java
  Log:
  put more expensive logging statements under log.isDebugEnabled() conditionals.
  
  Revision  Changes    Path
  1.19      +5 -2      db-torque/src/java/org/apache/torque/manager/MethodResultCache.java
  
  Index: MethodResultCache.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/manager/MethodResultCache.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MethodResultCache.java	20 Jun 2003 10:08:36 -0000	1.18
  +++ MethodResultCache.java	25 Aug 2003 16:33:22 -0000	1.19
  @@ -132,7 +132,10 @@
   
           if (result != null)
           {
  -            log.debug("MethodResultCache saved expensive operation: " + key);
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("MethodResultCache saved expensive operation: " + key);
  +            }
           }
           return result;
       }
  
  
  
  1.27      +23 -8     db-torque/src/java/org/apache/torque/oid/IDBroker.java
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- IDBroker.java	22 Aug 2003 17:25:31 -0000	1.26
  +++ IDBroker.java	25 Aug 2003 16:33:22 -0000	1.27
  @@ -541,8 +541,11 @@
               while (it.hasNext())
               {
                   String tableName = (String) it.next();
  -                log.debug("IDBroker thread checking for more keys "
  -                             + "on table: " + tableName);
  +                if (log.isDebugEnabled())
  +                {
  +                    log.debug("IDBroker thread checking for more keys "
  +                            + "on table: " + tableName);
  +                }
                   List availableIds = (List) ids.get(tableName);
                   int quantity = getQuantity(tableName, null).intValue();
                   if (quantity > availableIds.size())
  @@ -553,7 +556,10 @@
                           // want the quantity to be adjusted for thread
                           // calls.
                           storeIDs(tableName, false, null);
  -                        log.debug("Retrieved more ids for table: " + tableName);
  +                        if (log.isDebugEnabled())
  +                        {
  +                            log.debug("Retrieved more ids for table: " + tableName);
  +                        }
                       }
                       catch (Exception exc)
                       {
  @@ -608,8 +614,11 @@
               int timeLapse = (int) (nowLong - thenLong);
               if (timeLapse < SLEEP_PERIOD && timeLapse > 0)
               {
  -                log.debug("Unscheduled retrieval of more ids for table: "
  -                             + tableName);
  +                if (log.isDebugEnabled())
  +                {
  +                    log.debug("Unscheduled retrieval of more ids for table: "
  +                            + tableName);
  +                }
                   // Increase quantity, so that hopefully this does not
                   // happen again.
                   float rate = getQuantity(tableName, null).floatValue()
  @@ -853,7 +862,10 @@
   
           Statement statement = null;
   
  -        log.debug("updateNextId: " + stmt.toString());
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug("updateNextId: " + stmt.toString());
  +        }
   
           try
           {
  @@ -893,7 +905,10 @@
   
           Statement statement = null;
   
  -        log.debug("updateQuantity: " + stmt.toString());
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug("updateQuantity: " + stmt.toString());
  +        }
   
           try
           {
  
  
  
  1.10      +5 -2      db-torque/src/java/org/apache/torque/oid/SequenceIdGenerator.java
  
  Index: SequenceIdGenerator.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/SequenceIdGenerator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SequenceIdGenerator.java	14 May 2003 19:38:04 -0000	1.9
  +++ SequenceIdGenerator.java	25 Aug 2003 16:33:22 -0000	1.10
  @@ -190,7 +190,10 @@
           throws Exception
       {
           String idSql = dbAdapter.getIDMethodSQL(keyInfo);
  -        log.debug(idSql);
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug(idSql);
  +        }
   
           // Execute the query.
           QueryDataSet qds = new QueryDataSet(connection, idSql);
  
  
  
  1.76      +22 -7     db-torque/src/java/org/apache/torque/util/BasePeer.java
  
  Index: BasePeer.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/BasePeer.java,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- BasePeer.java	8 Aug 2003 16:57:50 -0000	1.75
  +++ BasePeer.java	25 Aug 2003 16:33:22 -0000	1.76
  @@ -564,7 +564,10 @@
                   tds = new TableDataSet(con, tab, kd);
                   String sqlSnippet = StringUtils.join(whereClause.iterator(), " AND ");
   
  -                log.debug("BasePeer.doDelete: whereClause=" + sqlSnippet);
  +                if (log.isDebugEnabled())
  +                {
  +                    log.debug("BasePeer.doDelete: whereClause=" + sqlSnippet);
  +                }
   
                   tds.where(sqlSnippet);
                   tds.fetchRecords();
  @@ -1011,7 +1014,10 @@
               }
               sql = query.toString();
           }
  -        log.debug(sql);
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug(sql);
  +        }
           return sql;
       }
   
  @@ -1531,8 +1537,11 @@
               // execute the query
               long startTime = System.currentTimeMillis();
               qds = new QueryDataSet(con, queryString);
  -            log.debug("Elapsed time=" 
  -                    + (System.currentTimeMillis() - startTime) + " ms");
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("Elapsed time=" 
  +                        + (System.currentTimeMillis() - startTime) + " ms");
  +            }
               results = getSelectResults(
                       qds, start, numberOfResults, singleRecord);
           }
  @@ -1914,7 +1923,10 @@
                   // Get affected records.
                   tds = new TableDataSet(con, tab, kd);
                   String sqlSnippet = StringUtils.join(whereClause.iterator(), " AND ");
  -                log.debug("BasePeer.doUpdate: whereClause=" + sqlSnippet);
  +                if (log.isDebugEnabled())
  +                {
  +                    log.debug("BasePeer.doUpdate: whereClause=" + sqlSnippet);
  +                }
                   tds.where(sqlSnippet);
                   tds.fetchRecords();
   
  @@ -2550,7 +2562,10 @@
               sql = query.toString();
           }
   
  -        log.debug(sql);
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug(sql);
  +        }
           queryString.append(sql);
       }
   
  
  
  
  1.13      +57 -32    db-torque/src/java/org/apache/torque/util/LargeSelect.java
  
  Index: LargeSelect.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/LargeSelect.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LargeSelect.java	20 Jun 2003 13:29:27 -0000	1.12
  +++ LargeSelect.java	25 Aug 2003 16:33:23 -0000	1.13
  @@ -564,8 +564,11 @@
       private synchronized List getResults(int start, int size)
               throws IllegalArgumentException, TorqueException
       {
  -        log.debug("getResults(start: " + start
  -                + ", size: " + size + ") invoked.");
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug("getResults(start: " + start
  +                    + ", size: " + size + ") invoked.");
  +        }
   
           if (size > memoryLimit)
           {
  @@ -578,10 +581,13 @@
           // retrieved.
           if (start >= blockBegin && (start + size - 1) <= blockEnd)
           {
  -            log.debug("getResults(): Sleeping until "
  -                    + "start+size-1 (" + (start + size - 1)
  -                    + ") > currentlyFilledTo (" + currentlyFilledTo
  -                    + ") && !queryCompleted (!" + queryCompleted + ")");
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("getResults(): Sleeping until "
  +                        + "start+size-1 (" + (start + size - 1)
  +                        + ") > currentlyFilledTo (" + currentlyFilledTo
  +                        + ") && !queryCompleted (!" + queryCompleted + ")");
  +            }
               while (((start + size - 1) > currentlyFilledTo) && !queryCompleted)
               {
                   try
  @@ -599,8 +605,11 @@
           // might want at least 2 sets of data.
           else if (start < blockBegin && start >= 0)
           {
  -            log.debug("getResults(): Paging backwards as start (" + start
  -                    + ") < blockBegin (" + blockBegin + ") && start >= 0");
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("getResults(): Paging backwards as start (" + start
  +                        + ") < blockBegin (" + blockBegin + ") && start >=
0");
  +            }
               stopQuery();
               if (memoryLimit >= 2 * size)
               {
  @@ -623,9 +632,12 @@
           // Assume we are moving on, do not retrieve any records prior to start.
           else if ((start + size - 1) > blockEnd)
           {
  -            log.debug("getResults(): Paging past end of loaded data as "
  -                    + "start+size-1 (" + (start + size - 1)
  -                    + ") > blockEnd (" + blockEnd + ")");
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("getResults(): Paging past end of loaded data as "
  +                        + "start+size-1 (" + (start + size - 1)
  +                        + ") > blockEnd (" + blockEnd + ")");
  +            }
               stopQuery();
               blockBegin = start;
               blockEnd = blockBegin + memoryLimit - 1;
  @@ -642,10 +654,14 @@
   
           int fromIndex = start - blockBegin;
           int toIndex = fromIndex + Math.min(size, results.size() - fromIndex);
  -        log.debug("getResults(): Retrieving records from results elements "
  -                + "start-blockBegin (" + fromIndex + ") through "
  -                + "fromIndex + Math.min(size, results.size() - fromIndex) ("
  -                + toIndex + ")");
  +
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug("getResults(): Retrieving records from results elements "
  +                    + "start-blockBegin (" + fromIndex + ") through "
  +                    + "fromIndex + Math.min(size, results.size() - fromIndex) ("
  +                    + toIndex + ")");
  +        }
           List returnResults = results.subList(fromIndex, toIndex);
   
           if (null != returnBuilderClass)
  @@ -694,10 +710,13 @@
               conn = Torque.getConnection(dbName);
   
               // Execute the query.
  -            log.debug("run(): query = " + query);
  -            log.debug("run(): memoryLimit = " + memoryLimit);
  -            log.debug("run(): blockBegin = " + blockBegin);
  -            log.debug("run(): blockEnd = " + blockEnd);
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("run(): query = " + query);
  +                log.debug("run(): memoryLimit = " + memoryLimit);
  +                log.debug("run(): blockBegin = " + blockBegin);
  +                log.debug("run(): blockEnd = " + blockEnd);
  +            }
               qds = new QueryDataSet(conn, query);
   
               // Continue getting rows one page at a time until the memory limit
  @@ -715,8 +734,11 @@
                       size = blockEnd - currentlyFilledTo + 1;
                   }
   
  -                log.debug("run(): Invoking BasePeer.getSelectResults(qds, "
  -                        + size + ", false)");
  +                if (log.isDebugEnabled())
  +                {
  +                    log.debug("run(): Invoking BasePeer.getSelectResults(qds, "
  +                            + size + ", false)");
  +                }
   
                   List tempResults
                           = BasePeer.getSelectResults(qds, size, false);
  @@ -759,16 +781,19 @@
                   qds.clearRecords();
               }
   
  -            log.debug("run(): While loop terminated because either:");
  -            log.debug("run(): 1. qds.allRecordsRetrieved(): "
  -                    + qds.allRecordsRetrieved());
  -            log.debug("run(): 2. killThread: " + killThread);
  -            log.debug("run(): 3. !(currentlyFilledTo + size <= blockEnd): !"
  -                    + (currentlyFilledTo + pageSize <= blockEnd));
  -            log.debug("run(): - currentlyFilledTo: " + currentlyFilledTo);
  -            log.debug("run(): - size: " + pageSize);
  -            log.debug("run(): - blockEnd: " + blockEnd);
  -            log.debug("run(): - results.size(): " + results.size());
  +            if (log.isDebugEnabled())
  +            {
  +                log.debug("run(): While loop terminated because either:");
  +                log.debug("run(): 1. qds.allRecordsRetrieved(): "
  +                        + qds.allRecordsRetrieved());
  +                log.debug("run(): 2. killThread: " + killThread);
  +                log.debug("run(): 3. !(currentlyFilledTo + size <= blockEnd): !"
  +                        + (currentlyFilledTo + pageSize <= blockEnd));
  +                log.debug("run(): - currentlyFilledTo: " + currentlyFilledTo);
  +                log.debug("run(): - size: " + pageSize);
  +                log.debug("run(): - blockEnd: " + blockEnd);
  +                log.debug("run(): - results.size(): " + results.size());
  +            }
           }
           catch (TorqueException e)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message